From 2f10494ace5729ad4c834d57f4960b48b09877f6 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 5 Dec 2016 09:39:16 -0500 Subject: [PATCH] Cleanup: remove cmm_wmb() from rcu_xchg_pointer and rcu_cmpxchg_pointer 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 --- include/urcu/static/urcu-pointer.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/urcu/static/urcu-pointer.h b/include/urcu/static/urcu-pointer.h index 28333c5..6e120fc 100644 --- a/include/urcu/static/urcu-pointer.h +++ b/include/urcu/static/urcu-pointer.h @@ -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); \ }) -- 2.34.1