[lttng-dev] [RFC PATCH urcu 2/3] Cleanup: remove cmm_wmb() from rcu_xchg_pointer and rcu_cmpxchg_pointer
Mathieu Desnoyers
mathieu.desnoyers at efficios.com
Mon Dec 5 17:31:12 UTC 2016
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 at efficios.com>
---
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.1.4
More information about the lttng-dev
mailing list