Skip to content

Commit a55d1cb

Browse files
committed
fs: switch f_iocb_flags and f_ra
Now that we shrank struct file by 24 bytes we still have a 4 byte hole. If we move struct file_ra_state into the union and f_iocb_flags out of the union we close that whole and bring down struct file to 192 bytes. Which means struct file is 3 cachelines and we managed to shrink it by 40 bytes this cycle. I've tried to audit all codepaths that use f_ra and none of them seem to rely on it in file->f_op->release() and never have since commit 1da177e4c3f4 ("Linux-2.6.12-rc2"). Link: https://lore.kernel.org/r/20240823-luftdicht-berappen-d69a2166a0db@brauner Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 1934b21 commit a55d1cb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/linux/fs.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,9 @@ struct file {
999999
struct callback_head f_task_work;
10001000
/* fput() must use workqueue (most kernel threads). */
10011001
struct llist_node f_llist;
1002-
unsigned int f_iocb_flags;
1002+
/* Invalid after last fput(). */
1003+
struct file_ra_state f_ra;
10031004
};
1004-
10051005
/*
10061006
* Protects f_ep, f_flags.
10071007
* Must not be taken from IRQ context.
@@ -1012,9 +1012,9 @@ struct file {
10121012
struct mutex f_pos_lock;
10131013
loff_t f_pos;
10141014
unsigned int f_flags;
1015+
unsigned int f_iocb_flags;
10151016
struct fown_struct *f_owner;
10161017
const struct cred *f_cred;
1017-
struct file_ra_state f_ra;
10181018
struct path f_path;
10191019
struct inode *f_inode; /* cached value */
10201020
const struct file_operations *f_op;

0 commit comments

Comments
 (0)