)]}'
{
  "commit": "12d40e43d251de4fa1f982567fc8b4ee5e858367",
  "tree": "91a562fc73af84efe6e8a388ccd2f907c04fa674",
  "parents": [
    "652d3a3ed7610bb09530127ca297b538fe7d245a"
  ],
  "author": {
    "name": "Arnaldo Carvalho de Melo",
    "email": "acme@mandriva.com",
    "time": "Wed Dec 06 20:39:53 2006 -0800"
  },
  "committer": {
    "name": "Linus Torvalds",
    "email": "torvalds@woody.osdl.org",
    "time": "Thu Dec 07 08:39:43 2006 -0800"
  },
  "message": "[PATCH] Save some bytes in struct inode\n\n[acme@newtoy net-2.6.20]$ pahole --cacheline 64 fs/inode.o inode\n/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/dcache.h:86 */\nstruct inode {\n        struct hlist_node          i_hash;               /*     0     8 */\n        struct list_head           i_list;               /*     8     8 */\n        struct list_head           i_sb_list;            /*    16     8 */\n        struct list_head           i_dentry;             /*    24     8 */\n        long unsigned int          i_ino;                /*    32     4 */\n        atomic_t                   i_count;              /*    36     4 */\n        umode_t                    i_mode;               /*    40     2 */\n\n        /* XXX 2 bytes hole, try to pack */\n\n        unsigned int               i_nlink;              /*    44     4 */\n        uid_t                      i_uid;                /*    48     4 */\n        gid_t                      i_gid;                /*    52     4 */\n        dev_t                      i_rdev;               /*    56     4 */\n        loff_t                     i_size;               /*    60     8 */\n        struct timespec            i_atime;              /*    68     8 */\n        struct timespec            i_mtime;              /*    76     8 */\n        struct timespec            i_ctime;              /*    84     8 */\n        unsigned int               i_blkbits;            /*    92     4 */\n        long unsigned int          i_version;            /*    96     4 */\n        blkcnt_t                   i_blocks;             /*   100     4 */\n        short unsigned int         i_bytes;              /*   104     2 */\n\n        /* XXX 2 bytes hole, try to pack */\n\n        spinlock_t                 i_lock;               /*   108    40 */\n        struct mutex               i_mutex;              /*   148    76 */\n        struct rw_semaphore        i_alloc_sem;          /*   224    64 */\n        struct inode_operations *  i_op;                 /*   288     4 */\n        const struct file_operations  * i_fop;           /*   292     4 */\n        struct super_block *       i_sb;                 /*   296     4 */\n        struct file_lock *         i_flock;              /*   300     4 */\n        struct address_space *     i_mapping;            /*   304     4 */\n        struct address_space       i_data;               /*   308   188 */\n        struct list_head           i_devices;            /*   496     8 */\n        union                      ;                     /*   504     4 */\n        int                        i_cindex;             /*   508     4 */\n        __u32                      i_generation;         /*   512     4 */\n        /* ---------- cacheline 8 boundary ---------- */\n        long unsigned int          i_dnotify_mask;       /*   516     4 */\n        struct dnotify_struct *    i_dnotify;            /*   520     4 */\n        struct list_head           inotify_watches;      /*   524     8 */\n        struct mutex               inotify_mutex;        /*   532    76 */\n        long unsigned int          i_state;              /*   608     4 */\n        long unsigned int          dirtied_when;         /*   612     4 */\n        unsigned int               i_flags;              /*   616     4 */\n        atomic_t                   i_writecount;         /*   620     4 */\n        void *                     i_security;           /*   624     4 */\n        void *                     i_private;            /*   628     4 */\n}; /* size: 632, sum members: 628, holes: 2, sum holes: 4 */\n\n[acme@newtoy net-2.6.20]$\n\nSo just moving i_mode to after i_bytes we save 4 bytes by nuking both holes:\n\n[acme@newtoy net-2.6.20]$ codiff -V /tmp/inode.o.before fs/inode.o\n/pub/scm/linux/kernel/git/acme/net-2.6.20/fs/inode.c:\n  struct inode |   -4\n    i_mode;\n     from: umode_t               /*    40(0)     2(0) */\n     to:   umode_t               /*   102(0)     2(0) */\n 1 struct changed\n[acme@newtoy net-2.6.20]$\n\nI\u0027ve prunned all the other offset changes, only this one is of interest here.\n\nSo now we have:\n\n[acme@newtoy net-2.6.20]$ pahole --cacheline 64 ../OUTPUT/qemu/net-2.6.20/fs/inode.o inode\n/* /pub/scm/linux/kernel/git/acme/net-2.6.20/include/linux/dcache.h:86 */\nstruct inode {\n        struct hlist_node          i_hash;               /*     0     8 */\n        struct list_head           i_list;               /*     8     8 */\n        struct list_head           i_sb_list;            /*    16     8 */\n        struct list_head           i_dentry;             /*    24     8 */\n        long unsigned int          i_ino;                /*    32     4 */\n        atomic_t                   i_count;              /*    36     4 */\n        unsigned int               i_nlink;              /*    40     4 */\n        uid_t                      i_uid;                /*    44     4 */\n        gid_t                      i_gid;                /*    48     4 */\n        dev_t                      i_rdev;               /*    52     4 */\n        loff_t                     i_size;               /*    56     8 */\n        /* ---------- cacheline 1 boundary ---------- */\n        struct timespec            i_atime;              /*    64     8 */\n        struct timespec            i_mtime;              /*    72     8 */\n        struct timespec            i_ctime;              /*    80     8 */\n        unsigned int               i_blkbits;            /*    88     4 */\n        long unsigned int          i_version;            /*    92     4 */\n        blkcnt_t                   i_blocks;             /*    96     4 */\n        short unsigned int         i_bytes;              /*   100     2 */\n        umode_t                    i_mode;               /*   102     2 */\n        spinlock_t                 i_lock;               /*   104    40 */\n        struct mutex               i_mutex;              /*   144    76 */\n        struct rw_semaphore        i_alloc_sem;          /*   220    64 */\n        struct inode_operations *  i_op;                 /*   284     4 */\n        const struct file_operations  * i_fop;           /*   288     4 */\n        struct super_block *       i_sb;                 /*   292     4 */\n        struct file_lock *         i_flock;              /*   296     4 */\n        struct address_space *     i_mapping;            /*   300     4 */\n        struct address_space       i_data;               /*   304   188 */\n        struct list_head           i_devices;            /*   492     8 */\n        union                      ;                     /*   500     4 */\n        int                        i_cindex;             /*   504     4 */\n        __u32                      i_generation;         /*   508     4 */\n        /* ---------- cacheline 8 boundary ---------- */\n        long unsigned int          i_dnotify_mask;       /*   512     4 */\n        struct dnotify_struct *    i_dnotify;            /*   516     4 */\n        struct list_head           inotify_watches;      /*   520     8 */\n        struct mutex               inotify_mutex;        /*   528    76 */\n        long unsigned int          i_state;              /*   604     4 */\n        long unsigned int          dirtied_when;         /*   608     4 */\n        unsigned int               i_flags;              /*   612     4 */\n        atomic_t                   i_writecount;         /*   616     4 */\n        void *                     i_security;           /*   620     4 */\n        void *                     i_private;            /*   624     4 */\n}; /* size: 628 */\n\n[acme@newtoy net-2.6.20]$\n\nSigned-off-by: Arnaldo Carvalho de Melo \u003cacme@mandriva.com\u003e\nSigned-off-by: Andrew Morton \u003cakpm@osdl.org\u003e\nSigned-off-by: Linus Torvalds \u003ctorvalds@osdl.org\u003e\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "3a1927e516d041ad4b7e0197f729cd81b2043acd",
      "old_mode": 33188,
      "old_path": "include/linux/fs.h",
      "new_id": "70b99fbb560bc4aba52e0013900d5534b77a6038",
      "new_mode": 33188,
      "new_path": "include/linux/fs.h"
    }
  ]
}
