Re: [PATCH 2/2] vfs: reorder struct file structure elements to remove unneeded padding.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 18, 2024 at 07:35:05PM GMT, Junchao Sun wrote:
> By reordering the elements in the struct file structure, we can
> reduce the padding needed on an x86_64 system by 8 bytes.
> 
> Signed-off-by: Junchao Sun <sunjunchao2870@xxxxxxxxx>
> ---
>  include/linux/fs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 0283cf366c2a..9235b7a960d3 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -999,10 +999,10 @@ struct file {
>  	 */
>  	spinlock_t		f_lock;
>  	fmode_t			f_mode;
> +	unsigned int		f_flags;

Iiuc, then this will push f_pos_lock into a new cache line whereas it's
explicitly optimized so that f_lock, f_mode, and f_pos_lock are all in
the same cache line.

You could play around with moving the union to the end of struct file.




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux