[PATCH] Avoid cache bounce in __d_lookup()

From: Paul Menage (pmenage@ensim.com)
Date: Sat May 04 2002 - 19:08:28 EST

__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))
- dentry->d_vfs_flags |= DCACHE_REFERENCED;
+ if(!(dentry->d_vfs_flags & DCACHE_REFERENCED))
+ dentry->d_vfs_flags |= DCACHE_REFERENCED;
                 return dentry;
         return NULL;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

This archive was generated by hypermail 2b29 : Tue May 07 2002 - 22:00:23 EST