From: Eric Dumazet <dada1@cosmosbay.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Al Viro <viro@ftp.linux.org.uk>,
linux-kernel@vger.kernel.org, David Miller <davem@davemloft.net>
Subject: [PATCH] [DCACHE] : avoid RCU for never hashed dentries
Date: Wed, 22 Nov 2006 18:53:26 +0100 [thread overview]
Message-ID: <200611221853.27037.dada1@cosmosbay.com> (raw)
In-Reply-To: <200610311948.48970.dada1@cosmosbay.com>
[-- Attachment #1: Type: text/plain, Size: 540 bytes --]
Some dentries dont 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>
[-- Attachment #2: avoid_rcu_dcache.patch --]
[-- Type: text/plain, Size: 1132 bytes --]
--- linux-2.6.19-rc6/fs/dcache.c 2006-11-22 17:33:33.000000000 +0100
+++ linux-2.6.19-rc6-ed/fs/dcache.c 2006-11-22 17:33:58.000000000 +0100
@@ -68,15 +68,19 @@ struct dentry_stat_t dentry_stat = {
.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))
kfree(dentry->d_name.name);
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
* inside dcache_lock.
@@ -85,7 +89,11 @@ static void d_free(struct dentry *dentry
{
if (dentry->d_op && dentry->d_op->d_release)
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);
}
/*
next prev parent reply other threads:[~2006-11-22 17:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20061024141739.GB18364@nuim.ie>
[not found] ` <20061025084726.GE18364@nuim.ie>
[not found] ` <20061025.230615.92585270.davem@davemloft.net>
2006-10-31 18:48 ` [RFC, PATCH] dont insert sockets/pipes dentries into dentry_hashtable Eric Dumazet
2006-11-01 7:19 ` David Miller
2006-11-01 8:21 ` Eric Dumazet
2006-11-01 8:34 ` David Miller
2006-11-01 8:38 ` Al Viro
2006-11-01 8:42 ` Al Viro
2006-11-01 9:04 ` Eric Dumazet
2006-11-01 13:54 ` Eric Dumazet
2006-11-22 17:53 ` Eric Dumazet [this message]
2006-11-22 18:00 ` [PATCH] [NET] dont insert socket " Eric Dumazet
2006-11-28 23:35 ` David Miller
2006-11-29 0:13 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200611221853.27037.dada1@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ftp.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®