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-next>] [day] [month] [year] [list]
Message-ID: <485CCFB9.9050208@cn.fujitsu.com>
Date:	Sat, 21 Jun 2008 17:54:01 +0800
From:	Lai Jiangshan <laijs@...fujitsu.com>
To:	Andrew Morton <akpm@...ux-foundation.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	linux-arch@...r.kernel.org
CC:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH]rcu,alpha: avoid smp_read_barrier_depends in rcu_dereference
 when pointer==NULL

Hi, Paul and Alpha hackers

memory barrier is expensive, I think it's worth that adding an if-statement
to avoid it when pointer == NULL.

This patch change nothing in UP or in other architectures for compiler's
optimization.

			Thanks, Lai Jiangshan


Signed-off-by: Lai Jiangshan <laijs@...fujitsu.com>
---
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index d42dbec..8979f29 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -143,7 +143,8 @@ struct rcu_head {
 
 #define rcu_dereference(p)     ({ \
 				typeof(p) _________p1 = ACCESS_ONCE(p); \
-				smp_read_barrier_depends(); \
+				if (_________p1) \
+					smp_read_barrier_depends(); \
 				(_________p1); \
 				})
 



--
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