mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] struct vfsmount : keep mnt_count & mnt_expiry_mark away from mnt_flags
Date: Fri, 15 Dec 2006 18:51:58 +0100	[thread overview]
Message-ID: <200612151851.58741.dada1@cosmosbay.com> (raw)
In-Reply-To: <20061215081138.4c51e7c5.akpm@osdl.org>

[-- Attachment #1: Type: text/plain, Size: 860 bytes --]

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 <dada1@cosmosbay.com>


[-- Attachment #2: vfsmount.patch --]
[-- Type: text/plain, Size: 1234 bytes --]

--- linux-2.6.20-rc1-mm1/include/linux/mount.h	2006-12-14 02:14:23.000000000 +0100
+++ linux-2.6.20-rc1-mm1-ed/include/linux/mount.h	2006-12-15 19:30:54.000000000 +0100
@@ -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;
 };
 

  parent reply	other threads:[~2006-12-15 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200612150823.kBF8NV2u011171@shell0.pdx.osdl.net>
2006-12-15  8:31 ` + schedule_on_each_cpu-use-preempt_disable.patch added to -mm tree Ingo Molnar
2006-12-15 16:11   ` Andrew Morton
2006-12-15 16:24     ` Ingo Molnar
2006-12-15 19:27       ` Andrew Morton
2006-12-15 17:51     ` Eric Dumazet [this message]
2006-12-15 18:38       ` [PATCH] avoid one conditional branch in touch_atime() Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200612151851.58741.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®