X-Git-Url: http://git.liburcu.org/?p=urcu.git;a=blobdiff_plain;f=include%2Furcu%2Fstatic%2Frculfqueue.h;fp=include%2Furcu%2Fstatic%2Frculfqueue.h;h=03c4ecdef76c6ee55102e5b36caaea5dee954841;hp=c0daffea78b5f1d2f2b65fb7baab205ae8da58dd;hb=0e2125fb7b2c7a92d7030b41df5fb372a7706c32;hpb=601922a81d884e16ff404cee7534ede56fb87d0a diff --git a/include/urcu/static/rculfqueue.h b/include/urcu/static/rculfqueue.h index c0daffe..03c4ecd 100644 --- a/include/urcu/static/rculfqueue.h +++ b/include/urcu/static/rculfqueue.h @@ -134,26 +134,29 @@ void _cds_lfq_enqueue_rcu(struct cds_lfq_queue_rcu *q, * uatomic_cmpxchg() implicit memory barrier orders earlier stores to * node before publication. */ - for (;;) { struct cds_lfq_node_rcu *tail, *next; tail = rcu_dereference(q->tail); - next = uatomic_cmpxchg(&tail->next, NULL, node); + cmm_emit_legacy_smp_mb(); + next = uatomic_cmpxchg_mo(&tail->next, NULL, node, + CMM_SEQ_CST, CMM_SEQ_CST); if (next == NULL) { /* * Tail was at the end of queue, we successfully * appended to it. Now move tail (another * enqueue might beat us to it, that's fine). */ - (void) uatomic_cmpxchg(&q->tail, tail, node); + (void) uatomic_cmpxchg_mo(&q->tail, tail, node, + CMM_SEQ_CST, CMM_SEQ_CST); return; } else { /* * Failure to append to current tail. * Help moving tail further and retry. */ - (void) uatomic_cmpxchg(&q->tail, tail, next); + (void) uatomic_cmpxchg_mo(&q->tail, tail, next, + CMM_SEQ_CST, CMM_SEQ_CST); continue; } } @@ -197,7 +200,8 @@ struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q) enqueue_dummy(q); next = rcu_dereference(head->next); } - if (uatomic_cmpxchg(&q->head, head, next) != head) + if (uatomic_cmpxchg_mo(&q->head, head, next, + CMM_SEQ_CST, CMM_SEQ_CST) != head) continue; /* Concurrently pushed. */ if (head->dummy) { /* Free dummy after grace period. */