From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
Andrew Morton <akpm@osdl.org>
Subject: Re: [patch] notifiers: fix blocking_notifier_call_chain() scalability
Date: Wed, 24 Jan 2007 02:11:10 +1100 [thread overview]
Message-ID: <45B6258E.2060402@yahoo.com.au> (raw)
In-Reply-To: <1169551494.6197.209.camel@twins>
Peter Zijlstra wrote:
> On Tue, 2007-01-23 at 10:45 +0100, Ingo Molnar wrote:
>>The fix is to enhance blocking_notifier_call_chain() to only take the
>>lock if there appears to be work on the call-chain.
>>
>>With this patch applied i get nicely saturated system, and much higher
>>munmap performance, on SMP systems.
>>
>>And as a bonus this also fixes a similar scalability bottleneck in the
>>thread-exit codepath: profile_task_exit() ...
>>
>>Signed-off-by: Ingo Molnar <mingo@elte.hu>
>
>
> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
>
>>---
>> kernel/sys.c | 15 +++++++++++----
>> 1 file changed, 11 insertions(+), 4 deletions(-)
>>
>>Index: linux/kernel/sys.c
>>===================================================================
>>--- linux.orig/kernel/sys.c
>>+++ linux/kernel/sys.c
>>@@ -325,11 +325,18 @@ EXPORT_SYMBOL_GPL(blocking_notifier_chai
>> int blocking_notifier_call_chain(struct blocking_notifier_head *nh,
>> unsigned long val, void *v)
>> {
>>- int ret;
>>+ int ret = NOTIFY_DONE;
>>
>>- down_read(&nh->rwsem);
>>- ret = notifier_call_chain(&nh->head, val, v);
>>- up_read(&nh->rwsem);
>>+ /*
>>+ * We check the head outside the lock, but if this access is
>>+ * racy then it does not matter what the result of the test
>>+ * is, we re-check the list after having taken the lock anyway:
>>+ */
Great idea!
>>+ if (rcu_dereference(nh->head)) {
Except rcu_dereference() is not needed.
>>+ down_read(&nh->rwsem);
>>+ ret = notifier_call_chain(&nh->head, val, v);
>>+ up_read(&nh->rwsem);
>>+ }
>> return ret;
>> }
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
prev parent reply other threads:[~2007-01-23 15:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 9:45 [patch] notifiers: fix blocking_notifier_call_chain() scalability Ingo Molnar
2007-01-23 11:24 ` Peter Zijlstra
2007-01-23 15:11 ` Nick Piggin [this message]
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=45B6258E.2060402@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=torvalds@osdl.org \
/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