urcu-defer: remove unnecessary memory barrier
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 20 Sep 2009 16:03:37 +0000 (12:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Sun, 20 Sep 2009 16:03:37 +0000 (12:03 -0400)
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 <mathieu.desnoyers@polymtl.ca>
urcu-defer-static.h

index 4cfa837e502632cc2f66b8f6cd5fe084efba11c0..a00ced033b6cc44fcf9b9e02d66cfbc54081e705 100644 (file)
@@ -150,7 +150,6 @@ static inline void _rcu_defer_queue(void (*fct)(void *p), void *p)
                assert(head - LOAD_SHARED(defer_queue.tail) == 0);
        }
 
                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)) {
        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);
                }
        }
        _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);
 }
 
        STORE_SHARED(defer_queue.head, head);
 }
 
This page took 0.027465 seconds and 4 git commands to generate.