[PATCH] reduce sizeof(struct file)
Now that RCU applied on 'struct file' seems stable, we can place f_rcuhead in a memory location that is not anymore used at call_rcu(&f->f_rcuhead, file_free_rcu) time, to reduce the size of this critical kernel object. The trick I used is to move f_rcuhead and f_list in an union called f_u The callers are changed so that f_rcuhead becomes f_u.fu_rcuhead and f_list becomes f_u.f_list Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
503af334ec
commit
2f51201662
@ -574,7 +574,14 @@ struct file_ra_state {
|
||||
#define RA_FLAG_INCACHE 0x02 /* file is already in cache */
|
||||
|
||||
struct file {
|
||||
struct list_head f_list;
|
||||
/*
|
||||
* fu_list becomes invalid after file_free is called and queued via
|
||||
* fu_rcuhead for RCU freeing
|
||||
*/
|
||||
union {
|
||||
struct list_head fu_list;
|
||||
struct rcu_head fu_rcuhead;
|
||||
} f_u;
|
||||
struct dentry *f_dentry;
|
||||
struct vfsmount *f_vfsmnt;
|
||||
struct file_operations *f_op;
|
||||
@ -598,7 +605,6 @@ struct file {
|
||||
spinlock_t f_ep_lock;
|
||||
#endif /* #ifdef CONFIG_EPOLL */
|
||||
struct address_space *f_mapping;
|
||||
struct rcu_head f_rcuhead;
|
||||
};
|
||||
extern spinlock_t files_lock;
|
||||
#define file_list_lock() spin_lock(&files_lock);
|
||||
|
Reference in New Issue
Block a user