rcuhlist: make pointer stores atomic
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Jun 2013 21:29:42 +0000 (17:29 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 21 Jun 2013 21:29:42 +0000 (17:29 -0400)
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 <mathieu.desnoyers@efficios.com>
urcu/rcuhlist.h

index 36da15bc31d95394420a6958c05a5435927b1c2b..6d88692e854faf51a4105a8c7d46baa5c624e6c6 100644 (file)
@@ -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);
 }
 
 /*
This page took 0.025857 seconds and 4 git commands to generate.