Commit 9a6c25fa authored by Hugh Dickins's avatar Hugh Dickins Committed by Liu Shixin
Browse files

shmem: shrink shmem_inode_info: dir_offsets in a union

mainline inclusion
from mainline-v6.7-rc1
commit ee615d4585cfc305bf6c218a62123c3051f8b4a3
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAIHPC

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ee615d4585cfc305bf6c218a62123c3051f8b4a3

--------------------------------

Patch series "shmem,tmpfs: general maintenance".

Mostly just cosmetic mods in mm/shmem.c, but the last two enforcing the
"size=" limit better.  8/8 goes into percpu counter territory, and could
stand alone.

This patch (of 8):

Shave 32 bytes off (the 64-bit) shmem_inode_info.  There was a 4-byte
pahole after stop_eviction, better filled by fsflags.  And the 24-byte
dir_offsets can only be used by directories, whereas shrinklist and
swaplist only by shmem_mapping() inodes (regular files or long symlinks):
so put those into a union.  No change in mm/shmem.c is required for this.

Link: https://lkml.kernel.org/r/c7441dc6-f3bb-dd60-c670-9f5cbd9f266@google.com
Link: https://lkml.kernel.org/r/86ebb4b-c571-b9e8-27f5-cb82ec50357e@google.com


Signed-off-by: default avatarHugh Dickins <hughd@google.com>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Reviewed-by: default avatarJan Kara <jack@suse.cz>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: Carlos Maiolino <cem@kernel.org>
Cc: Christian Brauner <brauner@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Darrick J. Wong <djwong@kernel.org>
Cc: Dave Chinner <dchinner@redhat.com>
Cc: Tim Chen <tim.c.chen@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Conflicts:
	include/linux/shmem_fs.h
[ Context conflicts with commit 9610fbcd. ]
Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
parent 1398fff0
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -23,18 +23,22 @@ struct shmem_inode_info {
	unsigned long		flags;
	unsigned long		alloced;	/* data pages alloced to file */
	unsigned long		swapped;	/* subtotal assigned to swap */
	pgoff_t			fallocend;	/* highest fallocate endindex */
	union {
	    struct offset_ctx	dir_offsets;	/* stable directory offsets */
	    struct {
		struct list_head shrinklist;	/* shrinkable hpage inodes */
		struct list_head swaplist;	/* chain of maybes on swap */
	    };
	};
	struct timespec64	i_crtime;	/* file creation time */
	struct shared_policy	policy;		/* NUMA memory alloc policy */
	struct simple_xattrs	xattrs;		/* list of xattrs */
	pgoff_t			fallocend;	/* highest fallocate endindex */
	unsigned int		fsflags;	/* for FS_IOC_[SG]ETFLAGS */
	atomic_t		stop_eviction;	/* hold when working on inode */
	struct timespec64	i_crtime;	/* file creation time */
	unsigned int		fsflags;	/* flags for FS_IOC_[SG]ETFLAGS */
#ifdef CONFIG_TMPFS_QUOTA
	struct dquot __rcu	*i_dquot[MAXQUOTAS];
#endif
	struct offset_ctx	dir_offsets;	/* stable entry offsets */
	struct inode		vfs_inode;
};