From: Mathieu Desnoyers Date: Fri, 21 Jun 2013 16:51:13 +0000 (-0400) Subject: rculist: ensure atomic updates of next pointers X-Git-Tag: v0.8.0~59 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=db757a4e5c7ecba45a79dc9c15090cb3deb659b5;p=userspace-rcu.git rculist: ensure atomic updates of next pointers in cds_list_add_rcu, use rcu_assign_pointer to update head->next atomically and provide the memory barrier before publishing head->next. Notice that we don't need the wmb() prior to store to prev, because RCU traversals only go forward, and thus only use "next". in cds_list_del_rcu, use CMM_STORE_SHARED() to store to elem->prev->next atomically. Signed-off-by: Mathieu Desnoyers --- diff --git a/urcu/rculist.h b/urcu/rculist.h index ab88226..1fd2df3 100644 --- a/urcu/rculist.h +++ b/urcu/rculist.h @@ -35,9 +35,8 @@ void cds_list_add_rcu(struct cds_list_head *newp, struct cds_list_head *head) { newp->next = head->next; newp->prev = head; - cmm_smp_wmb(); head->next->prev = newp; - head->next = newp; + rcu_assign_pointer(head->next, newp); } /* Add new element at the tail of the list. */ @@ -70,7 +69,7 @@ static inline void cds_list_del_rcu(struct cds_list_head *elem) { elem->next->prev = elem->prev; - elem->prev->next = elem->next; + CMM_STORE_SHARED(elem->prev->next, elem->next); } /*