mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-04-02 20:33:54 +00:00
[PATCH] dcache: avoid RCU for never-hashed dentries
Some dentries don't need to be globally visible in dentry hashtable. (pipes & sockets) Such dentries dont need to wait for a RCU grace period at delete time. Being able to free them permits a better CPU cache use (hot cache) This patch combined with (dont insert pipe dentries into dentry_hashtable) reduced time of { pipe(p); close(p[0]); close(p[1]);} on my UP machine (1.6 GHz Pentium-M) from 3.23 us to 2.86 us (But this patch does not depend on other patches, only bench results) Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Maneesh Soni <maneesh@in.ibm.com> Cc: "Paul E. McKenney" <paulmck@us.ibm.com> Cc: Dipankar Sarma <dipankar@in.ibm.com> Acked-by: David Miller <davem@davemloft.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
d18de5a272
commit
b3423415fb
1 changed files with 12 additions and 4 deletions
16
fs/dcache.c
16
fs/dcache.c
|
@ -68,15 +68,19 @@ struct dentry_stat_t dentry_stat = {
|
||||||
.age_limit = 45,
|
.age_limit = 45,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void d_callback(struct rcu_head *head)
|
static void __d_free(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu);
|
|
||||||
|
|
||||||
if (dname_external(dentry))
|
if (dname_external(dentry))
|
||||||
kfree(dentry->d_name.name);
|
kfree(dentry->d_name.name);
|
||||||
kmem_cache_free(dentry_cache, dentry);
|
kmem_cache_free(dentry_cache, dentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void d_callback(struct rcu_head *head)
|
||||||
|
{
|
||||||
|
struct dentry * dentry = container_of(head, struct dentry, d_u.d_rcu);
|
||||||
|
__d_free(dentry);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry
|
* no dcache_lock, please. The caller must decrement dentry_stat.nr_dentry
|
||||||
* inside dcache_lock.
|
* inside dcache_lock.
|
||||||
|
@ -85,7 +89,11 @@ static void d_free(struct dentry *dentry)
|
||||||
{
|
{
|
||||||
if (dentry->d_op && dentry->d_op->d_release)
|
if (dentry->d_op && dentry->d_op->d_release)
|
||||||
dentry->d_op->d_release(dentry);
|
dentry->d_op->d_release(dentry);
|
||||||
call_rcu(&dentry->d_u.d_rcu, d_callback);
|
/* if dentry was never inserted into hash, immediate free is OK */
|
||||||
|
if (dentry->d_hash.pprev == NULL)
|
||||||
|
__d_free(dentry);
|
||||||
|
else
|
||||||
|
call_rcu(&dentry->d_u.d_rcu, d_callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue