[LU-2565] reduce ldiskfs inode size Created: 03/Jan/13  Updated: 13/Feb/19  Resolved: 13/Feb/19

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.5.0, Lustre 2.8.0
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Andreas Dilger Assignee: WC Triage
Resolution: Low Priority Votes: 0
Labels: easy

Issue Links:
Related
is related to LU-1548 Test failure on test suite mds-survey... Resolved
Rank (Obsolete): 5994

 Description   

I noticed on the server that the ldiskfs_inode_cache is just over 1kB in size (1048 bytes on 2.7.56), which means only 3 inodes can fit into a 4kB page. It would be useful to reduce the inode size to be <= 1024 bytes in order to improve the memory efficiency by 1/3.



 Comments   
Comment by Andreas Dilger [ 13/Dec/16 ]

On RHEL 6.6 the ldiskfs_inode_info is 1056 bytes in size, but is only using 1040 bytes, so it could be shrunk with a bit of effort to reduce MDS memory usage by 1/3 for this slab. This can be seen easily with the pahole tool from the dwarves package:

# pahole -C ldiskfs_inode_info ldiskfs/ldiskfs/ldiskfs.ko |
struct ldiskfs_inode_info {
        __le32                     i_data[15];           /*     0    60 */
        __u32                      i_dtime;              /*    60     4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        ldiskfs_fsblk_t            i_file_acl;           /*    64     8 */
        struct semaphore           i_append_sem;         /*    72    24 */
        ldiskfs_lblk_t             i_dir_start_lookup;   /*    96     4 */
        ldiskfs_group_t            i_block_group;        /*   100     4 */
        long unsigned int          i_state_flags;        /*   104     8 */
        long unsigned int          i_flags;              /*   112     8 */
        struct rw_semaphore        xattr_sem;            /*   120    32 */
        /* --- cacheline 2 boundary (128 bytes) was 24 bytes ago --- */
        struct list_head           i_orphan;             /*   152    16 */
        loff_t                     i_disksize;           /*   168     8 */
        struct rw_semaphore        i_data_sem;           /*   176    32 */
        /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */
        struct inode               vfs_inode;            /*   208   592 */
        /* --- cacheline 12 boundary (768 bytes) was 32 bytes ago --- */
        struct jbd2_inode          jinode;               /*   800    48 */
        /* --- cacheline 13 boundary (832 bytes) was 16 bytes ago --- */
        long unsigned int          i_ext_generation;     /*   848     8 */
        struct ldiskfs_ext_cache   i_cached_extent;      /*   856    24 */

        /* XXX last struct has 4 bytes of padding */

        struct timespec            i_crtime;             /*   880    16 */
        /* --- cacheline 14 boundary (896 bytes) --- */
        struct list_head           i_prealloc_list;      /*   896    16 */
        spinlock_t                 i_prealloc_lock;      /*   912     4 */
        ldiskfs_group_t            i_last_alloc_group;   /*   916     4 */
        unsigned int               i_reserved_data_blocks; /*   920     4 */
        unsigned int               i_reserved_meta_blocks; /*   924     4 */
        unsigned int               i_allocated_meta_blocks; /*   928     4 */

        /* XXX 4 bytes hole, try to pack */

        sector_t                   i_da_metadata_calc_last_lblock; /*   936     8 */
        int                        i_da_metadata_calc_len; /*   944     4 */
        short unsigned int         i_delalloc_reserved_flag; /*   948     2 */
        __u16                      i_extra_isize;        /*   950     2 */
        spinlock_t                 i_block_reservation_lock; /*   952     4 */

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 15 boundary (960 bytes) --- */
        qsize_t                    i_reserved_quota;     /*   960     8 */
        struct list_head           i_aio_dio_complete_list; /*   968    16 */
        spinlock_t                 i_completed_io_lock;  /*   984     4 */

        /* XXX 4 bytes hole, try to pack */

        ldiskfs_io_end_t *         cur_aio_dio;          /*   992     8 */
        atomic_t                   i_aiodio_unwritten;   /*  1000     4 */
        tid_t                      i_sync_tid;           /*  1004     4 */
        struct mutex               i_aio_mutex;          /*  1008    32 */
        /* --- cacheline 16 boundary (1024 bytes) was 16 bytes ago --- */
        __u64                      i_fs_version;         /*  1040     8 */
        tid_t                      i_datasync_tid;       /*  1048     4 */

        /* size: 1056, cachelines: 17, members: 37 */
        /* sum members: 1040, holes: 3, sum holes: 12 */
        /* padding: 4 */
        /* paddings: 1, sum paddings: 4 */
        /* last cacheline: 32 bytes */
};
Comment by Andreas Dilger [ 13/Feb/19 ]

ldiskfs_inode_info is up to 1072 bytes in size with 1050 bytes in use, so shrinking it seems difficult at this point.

Generated at Sat Feb 10 01:26:16 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.