lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 24 Jan 2007 02:11:10 +1100
From:	Nick Piggin <nickpiggin@...oo.com.au>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
CC:	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org,
	Linus Torvalds <torvalds@...l.org>,
	Andrew Morton <akpm@...l.org>
Subject: Re: [patch] notifiers: fix blocking_notifier_call_chain()	scalability

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@...e.hu>
> 
> 
> Acked-by: Peter Zijlstra <a.p.zijlstra@...llo.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 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ