|
@@ -7,6 +7,7 @@
|
|
* RCU-protected list version
|
|
* RCU-protected list version
|
|
*/
|
|
*/
|
|
#include <linux/list.h>
|
|
#include <linux/list.h>
|
|
|
|
+#include <linux/rcupdate.h>
|
|
|
|
|
|
/*
|
|
/*
|
|
* Insert a new entry between two known consecutive entries.
|
|
* Insert a new entry between two known consecutive entries.
|
|
@@ -19,9 +20,8 @@ static inline void __list_add_rcu(struct list_head *new,
|
|
{
|
|
{
|
|
new->next = next;
|
|
new->next = next;
|
|
new->prev = prev;
|
|
new->prev = prev;
|
|
- smp_wmb();
|
|
|
|
|
|
+ rcu_assign_pointer(prev->next, new);
|
|
next->prev = new;
|
|
next->prev = new;
|
|
- prev->next = new;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -110,9 +110,8 @@ static inline void list_replace_rcu(struct list_head *old,
|
|
{
|
|
{
|
|
new->next = old->next;
|
|
new->next = old->next;
|
|
new->prev = old->prev;
|
|
new->prev = old->prev;
|
|
- smp_wmb();
|
|
|
|
|
|
+ rcu_assign_pointer(new->prev->next, new);
|
|
new->next->prev = new;
|
|
new->next->prev = new;
|
|
- new->prev->next = new;
|
|
|
|
old->prev = LIST_POISON2;
|
|
old->prev = LIST_POISON2;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -166,8 +165,7 @@ static inline void list_splice_init_rcu(struct list_head *list,
|
|
*/
|
|
*/
|
|
|
|
|
|
last->next = at;
|
|
last->next = at;
|
|
- smp_wmb();
|
|
|
|
- head->next = first;
|
|
|
|
|
|
+ rcu_assign_pointer(head->next, first);
|
|
first->prev = head;
|
|
first->prev = head;
|
|
at->prev = last;
|
|
at->prev = last;
|
|
}
|
|
}
|
|
@@ -280,10 +278,9 @@ static inline void hlist_replace_rcu(struct hlist_node *old,
|
|
|
|
|
|
new->next = next;
|
|
new->next = next;
|
|
new->pprev = old->pprev;
|
|
new->pprev = old->pprev;
|
|
- smp_wmb();
|
|
|
|
|
|
+ rcu_assign_pointer(*new->pprev, new);
|
|
if (next)
|
|
if (next)
|
|
new->next->pprev = &new->next;
|
|
new->next->pprev = &new->next;
|
|
- *new->pprev = new;
|
|
|
|
old->pprev = LIST_POISON2;
|
|
old->pprev = LIST_POISON2;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -310,12 +307,12 @@ static inline void hlist_add_head_rcu(struct hlist_node *n,
|
|
struct hlist_head *h)
|
|
struct hlist_head *h)
|
|
{
|
|
{
|
|
struct hlist_node *first = h->first;
|
|
struct hlist_node *first = h->first;
|
|
|
|
+
|
|
n->next = first;
|
|
n->next = first;
|
|
n->pprev = &h->first;
|
|
n->pprev = &h->first;
|
|
- smp_wmb();
|
|
|
|
|
|
+ rcu_assign_pointer(h->first, n);
|
|
if (first)
|
|
if (first)
|
|
first->pprev = &n->next;
|
|
first->pprev = &n->next;
|
|
- h->first = n;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -341,9 +338,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n,
|
|
{
|
|
{
|
|
n->pprev = next->pprev;
|
|
n->pprev = next->pprev;
|
|
n->next = next;
|
|
n->next = next;
|
|
- smp_wmb();
|
|
|
|
|
|
+ rcu_assign_pointer(*(n->pprev), n);
|
|
next->pprev = &n->next;
|
|
next->pprev = &n->next;
|
|
- *(n->pprev) = n;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -369,8 +365,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev,
|
|
{
|
|
{
|
|
n->next = prev->next;
|
|
n->next = prev->next;
|
|
n->pprev = &prev->next;
|
|
n->pprev = &prev->next;
|
|
- smp_wmb();
|
|
|
|
- prev->next = n;
|
|
|
|
|
|
+ rcu_assign_pointer(prev->next, n);
|
|
if (n->next)
|
|
if (n->next)
|
|
n->next->pprev = &n->next;
|
|
n->next->pprev = &n->next;
|
|
}
|
|
}
|