public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC][PATCH] rcu: Use WRITE_ONCE in RCU_INIT_POINTER
@ 2015-06-02 15:26 Peter Zijlstra
  2015-06-02 16:25 ` Paul E. McKenney
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Zijlstra @ 2015-06-02 15:26 UTC (permalink / raw)
  To: Paul McKenney; +Cc: josh, rostedt, mathieu.desnoyers, laijs, linux-kernel


For the paranoid amongst us GCC would be in its right to use byte stores
to write our NULL value, tell it not to do that.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 33a056bb886f..e173847b6543 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -1046,7 +1046,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
 #define RCU_INIT_POINTER(p, v) \
 	do { \
 		rcu_dereference_sparse(p, __rcu); \
-		p = RCU_INITIALIZER(v); \
+		WRITE_ONCE(p, RCU_INITIALIZER(v)); \
 	} while (0)
 
 /**

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

* Re: [RFC][PATCH] rcu: Use WRITE_ONCE in RCU_INIT_POINTER
  2015-06-02 15:26 [RFC][PATCH] rcu: Use WRITE_ONCE in RCU_INIT_POINTER Peter Zijlstra
@ 2015-06-02 16:25 ` Paul E. McKenney
  0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2015-06-02 16:25 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: josh, rostedt, mathieu.desnoyers, laijs, linux-kernel

On Tue, Jun 02, 2015 at 05:26:48PM +0200, Peter Zijlstra wrote:
> 
> For the paranoid amongst us GCC would be in its right to use byte stores
> to write our NULL value, tell it not to do that.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>

Good point, queued for 4.3.

							Thanx, Paul

> ---
>  include/linux/rcupdate.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
> index 33a056bb886f..e173847b6543 100644
> --- a/include/linux/rcupdate.h
> +++ b/include/linux/rcupdate.h
> @@ -1046,7 +1046,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
>  #define RCU_INIT_POINTER(p, v) \
>  	do { \
>  		rcu_dereference_sparse(p, __rcu); \
> -		p = RCU_INITIALIZER(v); \
> +		WRITE_ONCE(p, RCU_INITIALIZER(v)); \
>  	} while (0)
> 
>  /**
> 


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

end of thread, other threads:[~2015-06-02 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02 15:26 [RFC][PATCH] rcu: Use WRITE_ONCE in RCU_INIT_POINTER Peter Zijlstra
2015-06-02 16:25 ` 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