]> nv-tegra.nvidia Code Review - linux-2.6.git/commit
[PATCH] struct dentry: place d_hash close to d_parent and d_name to speedup lookups
authorEric Dumazet <dada1@cosmosbay.com>
Tue, 6 Sep 2005 22:18:16 +0000 (15:18 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 7 Sep 2005 23:57:41 +0000 (16:57 -0700)
commit3f4bb1f4199b7dc0c958447b1e4898980013b884
tree3d8aacfc6b7bbf7b2d224ae10ca693c55c64739e
parent0811bab24ff1eecab38110eda7ea7847db95c64e
[PATCH] struct dentry: place d_hash close to d_parent and d_name to speedup lookups

dentry cache uses sophisticated RCU technology (and prefetching if
available) but touches 2 cache lines per dentry during hlist lookup.

This patch moves d_hash in the same cache line than d_parent and d_name
fields so that :

1) One cache line is needed instead of two.

2) the hlist_for_each_rcu() prefetching has a chance to bring all the
   needed data in advance, not only the part that includes d_hash.next.

I also changed one old comment that was wrong for 64bits.

A further optimisation would be to separate dentry in two parts, one that
is mostly read, and one writen (d_count/d_lock) to avoid false sharing on
SMP/NUMA but this would need different field placement depending on 32bits
or 64bits platform.

Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
include/linux/dcache.h