public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH]rcu,alpha: avoid smp_read_barrier_depends in rcu_dereference when pointer==NULL
@ 2008-06-21  9:54 Lai Jiangshan
  2008-06-21 12:52 ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Lai Jiangshan @ 2008-06-21  9:54 UTC (permalink / raw)
  To: Andrew Morton, Paul E. McKenney, linux-arch; +Cc: Linux Kernel Mailing List

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@cn.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); \
 				})
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-06-21 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-21  9:54 [RFC PATCH]rcu,alpha: avoid smp_read_barrier_depends in rcu_dereference when pointer==NULL Lai Jiangshan
2008-06-21 12:52 ` Peter Zijlstra
2008-06-21 19:26   ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox