From: Mathieu Desnoyers Date: Fri, 1 Jul 2011 21:42:48 +0000 (-0400) Subject: rculfqueue: Document dummy pointer value access X-Git-Tag: v0.6.5~63 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=707c65a80f4bc33d6eb335f1128453dc60658232;p=userspace-rcu.git rculfqueue: Document dummy pointer value access Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/static/rculfqueue.h b/urcu/static/rculfqueue.h index 0970c0f..6045c18 100644 --- a/urcu/static/rculfqueue.h +++ b/urcu/static/rculfqueue.h @@ -62,7 +62,7 @@ struct cds_lfq_node_rcu_dummy { static inline int is_dummy(struct cds_lfq_queue_rcu *q, struct cds_lfq_node_rcu *node) { - return node == q->dummy; + return node == CMM_LOAD_SHARED(q->dummy); } static inline @@ -203,9 +203,13 @@ struct cds_lfq_node_rcu *_cds_lfq_dequeue_rcu(struct cds_lfq_queue_rcu *q) /* * We are the only thread * allowed to update dummy (we - * own the old dummy). + * own the old dummy). Other + * dequeue threads read it + * concurrently with RCU + * read-lock held, which + * protects from ABA. */ - q->dummy = node; + CMM_STORE_SHARED(q->dummy, node); _cds_lfq_enqueue_rcu(q, node); continue; /* try again */ }