Message ID | cover.1715169723.git.fdmanana@suse.com (mailing list archive) |
---|---|
Headers | show |
Series | btrfs: inode management and memory consumption improvements | expand |
On Wed, May 08, 2024 at 01:17:23PM +0100, fdmanana@kernel.org wrote: > From: Filipe Manana <fdmanana@suse.com> > > Some inode related improvements, to use an xarray to track open inodes per > root instead of a red black tree, reduce lock contention and use less memory > per btrfs inode, so now we can fit 4 inodes per 4K page instead of 3. > More details in the the change logs. Outstanding! You managed to reduce the size by 48 bytes, on my config from 1080 to 1032. Which unfortunately means it's still 3 inodes in a page. The config is maximal regarding the conditional features that affect size of struct inode. All of them could be enabled on distro kernels (checked on openSUSE): Ifdefs in include/linux/fs.h struct inode: #ifdef CONFIG_FS_POSIX_ACL #ifdef CONFIG_SECURITY #ifdef CONFIG_CGROUP_WRITEBACK #ifdef CONFIG_FSNOTIFY #ifdef CONFIG_FS_ENCRYPTION #ifdef CONFIG_FS_VERITY There's also #ifdef __NEED_I_SIZE_ORDERED but that's for 32bit only. This is the pahole diff summary before and after the patchset on for-next with my reference release config: - /* size: 1080, cachelines: 17, members: 39 */ - /* sum members: 1075, holes: 2, sum holes: 5 */ - /* forced alignments: 2 */ - /* last cacheline: 56 bytes */ + /* size: 1032, cachelines: 17, members: 36 */ + /* sum members: 1026, holes: 2, sum holes: 6 */ + /* forced alignments: 1 */ + /* last cacheline: 8 bytes */ The sum is still over 1024 so we'll need to find more tricks to reduce the space. There are 2 holes, one is 4 bytes (after i_otime_nsec) so there's still some potential.
On Thu, May 9, 2024 at 6:56 PM David Sterba <dsterba@suse.cz> wrote: > > On Wed, May 08, 2024 at 01:17:23PM +0100, fdmanana@kernel.org wrote: > > From: Filipe Manana <fdmanana@suse.com> > > > > Some inode related improvements, to use an xarray to track open inodes per > > root instead of a red black tree, reduce lock contention and use less memory > > per btrfs inode, so now we can fit 4 inodes per 4K page instead of 3. > > More details in the the change logs. > > Outstanding! You managed to reduce the size by 48 bytes, on my config > from 1080 to 1032. Which unfortunately means it's still 3 inodes in a > page. The config is maximal regarding the conditional features that > affect size of struct inode. All of them could be enabled on distro > kernels (checked on openSUSE): > > Ifdefs in include/linux/fs.h struct inode: > > #ifdef CONFIG_FS_POSIX_ACL > #ifdef CONFIG_SECURITY > #ifdef CONFIG_CGROUP_WRITEBACK > #ifdef CONFIG_FSNOTIFY > #ifdef CONFIG_FS_ENCRYPTION > #ifdef CONFIG_FS_VERITY > > There's also #ifdef __NEED_I_SIZE_ORDERED but that's for 32bit only. > > This is the pahole diff summary before and after the patchset on > for-next with my reference release config: > > - /* size: 1080, cachelines: 17, members: 39 */ > - /* sum members: 1075, holes: 2, sum holes: 5 */ > - /* forced alignments: 2 */ > - /* last cacheline: 56 bytes */ > + /* size: 1032, cachelines: 17, members: 36 */ > + /* sum members: 1026, holes: 2, sum holes: 6 */ > + /* forced alignments: 1 */ > + /* last cacheline: 8 bytes */ > > The sum is still over 1024 so we'll need to find more tricks to reduce > the space. There are 2 holes, one is 4 bytes (after i_otime_nsec) so > there's still some potential. I'm seeing a reduction down to 1016 bytes because I don't have CONFIG_FS_ENCRYPTION and CONFIG_FS_VERITY set. It's a very old kernel config I keep reusing for several years, so that explains it.
From: Filipe Manana <fdmanana@suse.com> Some inode related improvements, to use an xarray to track open inodes per root instead of a red black tree, reduce lock contention and use less memory per btrfs inode, so now we can fit 4 inodes per 4K page instead of 3. More details in the the change logs. Filipe Manana (8): btrfs: use an xarray to track open inodes in a root btrfs: preallocate inodes xarray entry to avoid transaction abort btrfs: reduce nesting and deduplicate error handling at btrfs_iget_path() btrfs: remove inode_lock from struct btrfs_root and use xarray locks btrfs: unify index_cnt and csum_bytes from struct btrfs_inode btrfs: don't allocate file extent tree for non regular files btrfs: remove location key from struct btrfs_inode btrfs: remove objectid from struct btrfs_inode on 64 bits platforms fs/btrfs/btrfs_inode.h | 130 +++++++++++----- fs/btrfs/ctree.h | 8 +- fs/btrfs/delayed-inode.c | 27 ++-- fs/btrfs/disk-io.c | 12 +- fs/btrfs/export.c | 2 +- fs/btrfs/file-item.c | 13 +- fs/btrfs/inode.c | 286 +++++++++++++++++------------------ fs/btrfs/ioctl.c | 8 +- fs/btrfs/relocation.c | 12 +- fs/btrfs/tests/btrfs-tests.c | 5 +- fs/btrfs/tree-log.c | 9 +- 11 files changed, 285 insertions(+), 227 deletions(-)