Commit:     4ba4d4c0c52201009232fe9e781a281054a24e75
Parent:     0aa5de8590d684274f57647a870851f101bb3543
Author:     Eric Dumazet <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 10 01:44:48 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Feb 11 10:51:25 2007 -0800

    [PATCH] struct vfsmount: keep mnt_count & mnt_expiry_mark away from 
    I noticed cache misses in touch_atime() that can be avoided if we keep
    mnt_count & mnt_expiry_mark in a different cache line than mnt_flags
    (mostly read)
    mnt_count & mnt_expiry_mark are modified each time a file is opened/closed
    in a file system.
    touch_atime() is called each time a file is read, and generally needs to
    read mnt_flags.
    Other fields of struct vfsmount are mostly read so I chose to move
    mnt_count & mnt_expiry_mark at the end of struct vfsmount.  And adding a
    comment so that nobody tries to re-arrange fields to fill the holes :)
    On 64bits platforms, the new offsetof(mnt_count) is 0xC0
    On 32bits platforms, it is 0x60, so I didnot add a
    ____cacheline_aligned_in_smp because it would have a too big impact on the
    size of this object (in particular if CONFIG_X86_L1_CACHE_SHIFT=7)
    Signed-off-by: Eric Dumazet <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 include/linux/mount.h |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/mount.h b/include/linux/mount.h
index 1b7e178..dab69af 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -43,9 +43,8 @@ struct vfsmount {
        struct super_block *mnt_sb;     /* pointer to superblock */
        struct list_head mnt_mounts;    /* list of children, anchored here */
        struct list_head mnt_child;     /* and going through their mnt_child */
-       atomic_t mnt_count;
        int mnt_flags;
-       int mnt_expiry_mark;            /* true if marked for expiry */
+       /* 4 bytes hole on 64bits arches */
        char *mnt_devname;              /* Name of device e.g. /dev/dsk/hda1 */
        struct list_head mnt_list;
        struct list_head mnt_expire;    /* link in fs-specific expiry list */
@@ -54,6 +53,13 @@ struct vfsmount {
        struct list_head mnt_slave;     /* slave list entry */
        struct vfsmount *mnt_master;    /* slave is on master->mnt_slave_list */
        struct mnt_namespace *mnt_ns;   /* containing namespace */
+       /*
+        * We put mnt_count & mnt_expiry_mark at the end of struct vfsmount
+        * to let these frequently modified fields in a separate cache line
+        * (so that reads of mnt_flags wont ping-pong on SMP machines)
+        */
+       atomic_t mnt_count;
+       int mnt_expiry_mark;            /* true if marked for expiry */
        int mnt_pinned;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to