Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1622336

[PATCH tip/core/rcu 6/9] doc: Update rcu_assign_pointer() definition in whatisRCU.txt

From "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Newsgroups linux.kernel
Subject [PATCH tip/core/rcu 6/9] doc: Update rcu_assign_pointer() definition in whatisRCU.txt
Date 2017-04-12 18:50 +0200
Message-ID <tvtCW-6Qp-27@gated-at.bofh.it> (permalink)
References <tvtCW-6Qp-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The rcu_assign_pointer() macro has changed over time, and the version
in Documentation/RCU/whatisRCU.txt has not kept up.  This commit brings
it into 2017, albeit in a simplified fashion.

Reported-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
 Documentation/RCU/whatisRCU.txt | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/Documentation/RCU/whatisRCU.txt b/Documentation/RCU/whatisRCU.txt
index 5cbd8b2395b8..6b0337008f9c 100644
--- a/Documentation/RCU/whatisRCU.txt
+++ b/Documentation/RCU/whatisRCU.txt
@@ -587,20 +587,21 @@ It is extremely simple:
 		write_unlock(&rcu_gp_mutex);
 	}
 
-[You can ignore rcu_assign_pointer() and rcu_dereference() without
-missing much.  But here they are anyway.  And whatever you do, don't
-forget about them when submitting patches making use of RCU!]
-
-	#define rcu_assign_pointer(p, v)	({ \
-							smp_wmb(); \
-							(p) = (v); \
-						})
-
-	#define rcu_dereference(p)     ({ \
-					typeof(p) _________p1 = p; \
-					smp_read_barrier_depends(); \
-					(_________p1); \
-					})
+[You can ignore rcu_assign_pointer() and rcu_dereference() without missing
+much.  But here are simplified versions anyway.  And whatever you do,
+don't forget about them when submitting patches making use of RCU!]
+
+	#define rcu_assign_pointer(p, v) \
+	({ \
+		smp_store_release(&(p), (v)); \
+	})
+
+	#define rcu_dereference(p) \
+	({ \
+		typeof(p) _________p1 = p; \
+		smp_read_barrier_depends(); \
+		(_________p1); \
+	})
 
 
 The rcu_read_lock() and rcu_read_unlock() primitive read-acquire
-- 
2.5.2

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH tip/core/rcu 0/9] Documentation updates for 4.12 "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 6/9] doc: Update rcu_assign_pointer() definition in whatisRCU.txt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 9/9] doc: Update control-dependencies section of memory-barriers.txt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 8/9] doc: Emphasize that "toy" RCU requires recursive rwlock "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 7/9] doc: Update the comparisons rule in rcu_dereference.txt "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 3/9] doc: Update stallwarn.txt to make causes more prominent "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200
  [PATCH tip/core/rcu 5/9] doc: Update requirements based on recent changes "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> - 2017-04-12 18:50 +0200

csiph-web