Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b6b3fdea authored by Eric Dumazet's avatar Eric Dumazet Committed by Al Viro
Browse files

filp_cachep can be static in fs/file_table.c



Instead of creating the "filp" kmem_cache in vfs_caches_init(),
we can do it a litle be later in files_init(), so that filp_cachep
is static to fs/file_table.c

Acked-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>

Signed-off-by: default avatarEric Dumazet <dada1@cosmosbay.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent fd659fd6
Loading
Loading
Loading
Loading
+0 −6
Original line number Original line Diff line number Diff line
@@ -2314,9 +2314,6 @@ static void __init dcache_init(void)
/* SLAB cache for __getname() consumers */
/* SLAB cache for __getname() consumers */
struct kmem_cache *names_cachep __read_mostly;
struct kmem_cache *names_cachep __read_mostly;


/* SLAB cache for file structures */
struct kmem_cache *filp_cachep __read_mostly;

EXPORT_SYMBOL(d_genocide);
EXPORT_SYMBOL(d_genocide);


void __init vfs_caches_init_early(void)
void __init vfs_caches_init_early(void)
@@ -2338,9 +2335,6 @@ void __init vfs_caches_init(unsigned long mempages)
	names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
	names_cachep = kmem_cache_create("names_cache", PATH_MAX, 0,
			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);
			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);


	filp_cachep = kmem_cache_create("filp", sizeof(struct file), 0,
			SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL);

	dcache_init();
	dcache_init();
	inode_init();
	inode_init();
	files_init(mempages);
	files_init(mempages);
+9 −1
Original line number Original line Diff line number Diff line
@@ -32,6 +32,9 @@ struct files_stat_struct files_stat = {
/* public. Not pretty! */
/* public. Not pretty! */
__cacheline_aligned_in_smp DEFINE_SPINLOCK(files_lock);
__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 struct percpu_counter nr_files __cacheline_aligned_in_smp;


static inline void file_free_rcu(struct rcu_head *head)
static inline void file_free_rcu(struct rcu_head *head)
@@ -397,7 +400,12 @@ int fs_may_remount_ro(struct super_block *sb)
void __init files_init(unsigned long mempages)
void __init files_init(unsigned long mempages)
{ 
{ 
	int n; 
	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. 
	 * Per default don't use more than 10% of our memory for files. 
	 */ 
	 */ 


+0 −2
Original line number Original line Diff line number Diff line
@@ -57,8 +57,6 @@ struct files_struct {


#define files_fdtable(files) (rcu_dereference((files)->fdt))
#define files_fdtable(files) (rcu_dereference((files)->fdt))


extern struct kmem_cache *filp_cachep;

struct file_operations;
struct file_operations;
struct vfsmount;
struct vfsmount;
struct dentry;
struct dentry;