aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dcache.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2006-03-26 04:37:24 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-26 11:56:56 -0500
commitfa3536cc144c1298f2ed9416c33f3b77fa2cd37a (patch)
tree5484541319b86ae7dac0def4db7925f7cc7008e7 /fs/dcache.c
parent878a9f30d7b13015f3aa4534d7877d985f150183 (diff)
[PATCH] Use __read_mostly on some hot fs variables
I discovered on oprofile hunting on a SMP platform that dentry lookups were slowed down because d_hash_mask, d_hash_shift and dentry_hashtable were in a cache line that contained inodes_stat. So each time inodes_stats is changed by a cpu, other cpus have to refill their cache line. This patch moves some variables to the __read_mostly section, in order to avoid false sharing. RCU dentry lookups can go full speed. 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 'fs/dcache.c')
-rw-r--r--fs/dcache.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fs/dcache.c b/fs/dcache.c
index 939584648504..aaca5e7970bc 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -36,7 +36,7 @@
36 36
37/* #define DCACHE_DEBUG 1 */ 37/* #define DCACHE_DEBUG 1 */
38 38
39int sysctl_vfs_cache_pressure = 100; 39int sysctl_vfs_cache_pressure __read_mostly = 100;
40EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure); 40EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
41 41
42 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock); 42 __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock);
@@ -44,7 +44,7 @@ static seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED;
44 44
45EXPORT_SYMBOL(dcache_lock); 45EXPORT_SYMBOL(dcache_lock);
46 46
47static kmem_cache_t *dentry_cache; 47static kmem_cache_t *dentry_cache __read_mostly;
48 48
49#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname)) 49#define DNAME_INLINE_LEN (sizeof(struct dentry)-offsetof(struct dentry,d_iname))
50 50
@@ -59,9 +59,9 @@ static kmem_cache_t *dentry_cache;
59#define D_HASHBITS d_hash_shift 59#define D_HASHBITS d_hash_shift
60#define D_HASHMASK d_hash_mask 60#define D_HASHMASK d_hash_mask
61 61
62static unsigned int d_hash_mask; 62static unsigned int d_hash_mask __read_mostly;
63static unsigned int d_hash_shift; 63static unsigned int d_hash_shift __read_mostly;
64static struct hlist_head *dentry_hashtable; 64static struct hlist_head *dentry_hashtable __read_mostly;
65static LIST_HEAD(dentry_unused); 65static LIST_HEAD(dentry_unused);
66 66
67/* Statistics gathering. */ 67/* Statistics gathering. */
@@ -1719,10 +1719,10 @@ static void __init dcache_init(unsigned long mempages)
1719} 1719}
1720 1720
1721/* SLAB cache for __getname() consumers */ 1721/* SLAB cache for __getname() consumers */
1722kmem_cache_t *names_cachep; 1722kmem_cache_t *names_cachep __read_mostly;
1723 1723
1724/* SLAB cache for file structures */ 1724/* SLAB cache for file structures */
1725kmem_cache_t *filp_cachep; 1725kmem_cache_t *filp_cachep __read_mostly;
1726 1726
1727EXPORT_SYMBOL(d_genocide); 1727EXPORT_SYMBOL(d_genocide);
1728 1728