author: James Morris <jmorris@namei.org> 2009-02-06 11:01:45 +1100
committer: James Morris <jmorris@namei.org> 2009-02-06 11:01:45 +1100
commit: cb5629b10d64a8006622ce3a52bc887d91057d69
parent: 8920d5ad6ba74ae8ab020e90cc4d976980e68701
Commit Summary:
Diffstat:
1 file changed, 7 insertions, 1 deletion
diff --git a/fs/file_table.c b/fs/file_table.c
index 55895ccc08c6..da806aceae3f 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -33,6 +33,9 @@ struct files_stat_struct files_stat = {
/* public. Not pretty! */
__cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
+/* SLAB cache for file structures */
+static struct kmem_cache *filp_cachep __read_mostly;
+
static struct percpu_counter nr_files __cacheline_aligned_in_smp;
static inline void file_free_rcu(struct rcu_head *head)
@@ -399,7 +402,12 @@ too_bad:
void __init files_init(unsigned long mempages)
{
int n;
- /* One file with associated inode and dcache is very roughly 1K.
+
+ filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
+ SLAB_HWCACHE_ALIGN | SLAB_PANIC, NULL);
+
+ /*
+ * One file with associated inode and dcache is very roughly 1K.
* Per default don't use more than 10% of our memory for files.
*/