From: Mathieu Desnoyers Date: Fri, 21 Jun 2013 21:29:42 +0000 (-0400) Subject: rcuhlist: make pointer stores atomic X-Git-Tag: v0.8.0~37 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=90bdf188e835cadbc12d5fa7e4523056ecd97cf4;p=urcu.git rcuhlist: make pointer stores atomic Use rcu_assign_pointer() to store into head->next in cds_hlist_add_head_rcu(). This includes the write barrier needed before publishing the new node. Use CMM_STORE_SHARED() to store into elem->prev->next in cds_hlist_del_rcu(). Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/rcuhlist.h b/urcu/rcuhlist.h index 36da15b..6d88692 100644 --- a/urcu/rcuhlist.h +++ b/urcu/rcuhlist.h @@ -36,10 +36,9 @@ void cds_hlist_add_head_rcu(struct cds_hlist_node *newp, { newp->next = head->next; newp->prev = (struct cds_hlist_node *)head; - cmm_smp_wmb(); if (head->next) head->next->prev = newp; - head->next = newp; + rcu_assign_pointer(head->next, newp); } /* Remove element from list. */ @@ -48,7 +47,7 @@ void cds_hlist_del_rcu(struct cds_hlist_node *elem) { if (elem->next) elem->next->prev = elem->prev; - elem->prev->next = elem->next; + CMM_STORE_SHARED(elem->prev->next, elem->next); } /*