diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-08-01 01:09:25 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2011-09-29 00:38:33 -0400 |
commit | d322f45ceed525daa9401154590bbae3222cfefb (patch) | |
tree | f9c2534f0b10d149af2f899ad200125dc29f631b /include/linux/rcupdate.h | |
parent | 7eb4f4553ceaa6c64da83c8a71d5a991c0188655 (diff) |
rcu: Make rcu_assign_pointer() unconditionally insert a memory barrier
Recent changes to gcc give warning messages on rcu_assign_pointers()'s
checks that allow it to determine when it is OK to omit the memory
barrier. Stephen Hemminger tried a number of gcc tricks to silence
this warning, but #pragmas and CPP macros do not work together in the
way that would be required to make this work.
However, we now have RCU_INIT_POINTER(), which already omits this
memory barrier, and which therefore may be used when assigning NULL to
an RCU-protected pointer that is accessible to readers. This commit
therefore makes rcu_assign_pointer() unconditionally emit the memory
barrier.
Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'include/linux/rcupdate.h')
-rw-r--r-- | include/linux/rcupdate.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index caf22e84a743..d7accc5f8892 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h | |||
@@ -443,9 +443,7 @@ extern int rcu_my_thread_group_empty(void); | |||
443 | }) | 443 | }) |
444 | #define __rcu_assign_pointer(p, v, space) \ | 444 | #define __rcu_assign_pointer(p, v, space) \ |
445 | ({ \ | 445 | ({ \ |
446 | if (!__builtin_constant_p(v) || \ | 446 | smp_wmb(); \ |
447 | ((v) != NULL)) \ | ||
448 | smp_wmb(); \ | ||
449 | (p) = (typeof(*v) __force space *)(v); \ | 447 | (p) = (typeof(*v) __force space *)(v); \ |
450 | }) | 448 | }) |
451 | 449 | ||