lkml.org 
[lkml]   [2010]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 23/52] fs: dcache percpu nr_dentry
The nr_dentry stat is a globally touched cacheline and atomic operation
twice over the lifetime of a dentry. It is used for the benfit of userspace
only. We could make a per-cpu counter or something for it, but it is only
accessed via proc, so we could use slab stats.

XXX: must implement slab routines to return stats for a single cache, and
implement the proc handler.

Signed-off-by: Nick Piggin <npiggin@suse.de>
---
fs/dcache.c | 5 +----
include/linux/dcache.h | 2 +-
2 files changed, 2 insertions(+), 5 deletions(-)

Index: linux-2.6/fs/dcache.c
===================================================================
--- linux-2.6.orig/fs/dcache.c
+++ linux-2.6/fs/dcache.c
@@ -105,7 +105,7 @@ static struct dcache_hash_bucket *dentry

/* Statistics gathering. */
struct dentry_stat_t dentry_stat = {
- .nr_dentry = ATOMIC_INIT(0),
+ .nr_dentry = 0,
.age_limit = 45,
};

@@ -146,7 +146,6 @@ static void d_callback(struct rcu_head *
*/
static void d_free(struct dentry *dentry)
{
- atomic_dec(&dentry_stat.nr_dentry);
BUG_ON(dentry->d_count);
if (dentry->d_op && dentry->d_op->d_release)
dentry->d_op->d_release(dentry);
@@ -1249,8 +1248,6 @@ struct dentry *d_alloc(struct dentry * p
spin_unlock(&parent->d_lock);
}

- atomic_inc(&dentry_stat.nr_dentry);
-
return dentry;
}
EXPORT_SYMBOL(d_alloc);
Index: linux-2.6/include/linux/dcache.h
===================================================================
--- linux-2.6.orig/include/linux/dcache.h
+++ linux-2.6/include/linux/dcache.h
@@ -38,7 +38,7 @@ struct qstr {
};

struct dentry_stat_t {
- atomic_t nr_dentry;
+ int nr_dentry; /* unused */
int nr_unused; /* protected by dcache_lru_lock */
int age_limit; /* age in seconds */
int want_pages; /* pages requested by system */



\
 
 \ /
  Last update: 2010-06-24 05:23    [W:0.471 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site