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]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux