Cleanup: remove cmm_wmb() from rcu_xchg_pointer and rcu_cmpxchg_pointer
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 5 Dec 2016 14:39:16 +0000 (09:39 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 5 Dec 2016 14:42:14 +0000 (09:42 -0500)
Both rcu_xchg_pointer() and rcu_cmpxchg_pointer() imply both release and
acquire barriers. Therefore, the extra cmm_wmb() is redundant and can be
removed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/urcu/static/urcu-pointer.h

index 28333c57746e927bfc44e06e0a9fcc2b0e4794e2..6e120fc983b128f55c5195403712da292cdc2dad 100644 (file)
@@ -79,6 +79,8 @@ extern "C" {
  * using synchronize_rcu(). If fails (unexpected value), returns old (which
  * should not be freed !).
  *
+ * uatomic_cmpxchg() acts as both release and acquire barriers.
+ *
  * This macro is less than 10 lines long.  The intent is that this macro
  * meets the 10-line criterion in LGPL, allowing this function to be
  * expanded directly in non-LGPL code.
@@ -88,9 +90,6 @@ extern "C" {
        ({                                                              \
                __typeof__(*p) _________pold = (old);                   \
                __typeof__(*p) _________pnew = (_new);                  \
-               if (!__builtin_constant_p(_new) ||                      \
-                   ((_new) != NULL))                                   \
-                       cmm_wmb();                                              \
                uatomic_cmpxchg(p, _________pold, _________pnew);       \
        })
 
@@ -99,6 +98,8 @@ extern "C" {
  * pointer to the data structure, which can be safely freed after waiting for a
  * quiescent state using synchronize_rcu().
  *
+ * uatomic_xchg() acts as both release and acquire barriers.
+ *
  * This macro is less than 10 lines long.  The intent is that this macro
  * meets the 10-line criterion in LGPL, allowing this function to be
  * expanded directly in non-LGPL code.
@@ -107,9 +108,6 @@ extern "C" {
        __extension__                                   \
        ({                                              \
                __typeof__(*p) _________pv = (v);       \
-               if (!__builtin_constant_p(v) ||         \
-                   ((v) != NULL))                      \
-                       cmm_wmb();                              \
                uatomic_xchg(p, _________pv);           \
        })
 
This page took 0.025935 seconds and 4 git commands to generate.