From 9374f873bd741e91b0b5c78a8e0406d849ca752e Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sun, 20 Sep 2009 12:03:37 -0400 Subject: [PATCH] urcu-defer: remove unnecessary memory barrier All synchronization between queue producer/consumer is performed by the write to "head". Before this write, none of the queued data is visible from the consumer point of view. Therefore, just a single wmb() is required before writing to head to ensure correct synchronization. This matches with the rmb() after reading head on the consumer side. Signed-off-by: Mathieu Desnoyers --- urcu-defer-static.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/urcu-defer-static.h b/urcu-defer-static.h index 4cfa837..a00ced0 100644 --- a/urcu-defer-static.h +++ b/urcu-defer-static.h @@ -150,7 +150,6 @@ static inline void _rcu_defer_queue(void (*fct)(void *p), void *p) assert(head - LOAD_SHARED(defer_queue.tail) == 0); } - smp_wmb(); /* Publish new pointer before write q[] */ if (unlikely(defer_queue.last_fct_in != fct)) { defer_queue.last_fct_in = fct; if (unlikely(DQ_IS_FCT_BIT(fct) || fct == DQ_FCT_MARK)) { @@ -181,7 +180,8 @@ static inline void _rcu_defer_queue(void (*fct)(void *p), void *p) } } _STORE_SHARED(defer_queue.q[head++ & DEFER_QUEUE_MASK], p); - smp_wmb(); /* Write q[] before head. */ + smp_wmb(); /* Publish new pointer before head */ + /* Write q[] before head. */ STORE_SHARED(defer_queue.head, head); } -- 2.34.1