diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2005-09-06 18:18:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-09-07 19:57:41 -0400 |
commit | 3f4bb1f4199b7dc0c958447b1e4898980013b884 (patch) | |
tree | 3d8aacfc6b7bbf7b2d224ae10ca693c55c64739e /include/linux | |
parent | 0811bab24ff1eecab38110eda7ea7847db95c64e (diff) |
[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>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dcache.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 50be290d24d2..ab04b4f9b0db 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -88,8 +88,9 @@ struct dentry { | |||
88 | * negative */ | 88 | * negative */ |
89 | /* | 89 | /* |
90 | * The next three fields are touched by __d_lookup. Place them here | 90 | * The next three fields are touched by __d_lookup. Place them here |
91 | * so they all fit in a 16-byte range, with 16-byte alignment. | 91 | * so they all fit in a cache line. |
92 | */ | 92 | */ |
93 | struct hlist_node d_hash; /* lookup hash list */ | ||
93 | struct dentry *d_parent; /* parent directory */ | 94 | struct dentry *d_parent; /* parent directory */ |
94 | struct qstr d_name; | 95 | struct qstr d_name; |
95 | 96 | ||
@@ -103,7 +104,6 @@ struct dentry { | |||
103 | void *d_fsdata; /* fs-specific data */ | 104 | void *d_fsdata; /* fs-specific data */ |
104 | struct rcu_head d_rcu; | 105 | struct rcu_head d_rcu; |
105 | struct dcookie_struct *d_cookie; /* cookie, if any */ | 106 | struct dcookie_struct *d_cookie; /* cookie, if any */ |
106 | struct hlist_node d_hash; /* lookup hash list */ | ||
107 | int d_mounted; | 107 | int d_mounted; |
108 | unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ | 108 | unsigned char d_iname[DNAME_INLINE_LEN_MIN]; /* small names */ |
109 | }; | 109 | }; |