linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Menage <pmenage@ensim.com>
To: viro@math.psu.edu
Cc: linux-kernel@vger.kernel.org
Cc: pmenage@ensim.com
Subject: [PATCH] Avoid cache bounce in __d_lookup()
Date: Sat, 04 May 2002 17:08:28 -0700	[thread overview]
Message-ID: <E1749Zk-00012g-00@pmenage-dt.ensim.com> (raw)


__d_lookup() sets DCACHE_REFERENCED in d->d_vfs_flags. In the vast
majority of lookups, this bit will already be set. To avoid unecessary
writes, and unnecessarily dirtying and bouncing the cache line
containing d_vfs_flags (which depending on the architecture, can also
contain d_op, and parts of d_name and d_iname) this patch only sets the
bit if it wasn't already set.

d_vfs_flags itself seems a bit of a waste - the only bit used in it
currently is DCACHE_REFERENCED. It might be better to move it to part of
d_flags, which is also mostly unused for local filesystems. But d_flags
appears to be protected by the BKL, rather than the dcache_lock, so the
two sets of bits might be incompatible unless we switched to using
set_bit()/clear_bit() for d_flags.

--- linux-2.5.13/fs/dcache.c	Thu May  2 17:22:42 2002
+++ linux-2.5.13-nodref/fs/dcache.c	Sat May  4 16:36:38 2002
@@ -883,7 +883,8 @@
 			if (memcmp(dentry->d_name.name, str, len))
 				continue;
 		}
-		dentry->d_vfs_flags |= DCACHE_REFERENCED;
+		if(!(dentry->d_vfs_flags & DCACHE_REFERENCED))
+			dentry->d_vfs_flags |= DCACHE_REFERENCED;
 		return dentry;
 	}
 	return NULL;




                 reply	other threads:[~2002-05-05  0:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1749Zk-00012g-00@pmenage-dt.ensim.com \
    --to=pmenage@ensim.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    /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;
as well as URLs for NNTP newsgroup(s).