diff options
Diffstat (limited to 'include/linux/rculist.h')
-rw-r--r-- | include/linux/rculist.h | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index aa9b3eb15683..8d2c81fccfe5 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
@@ -7,6 +7,7 @@ | |||
7 | * RCU-protected list version | 7 | * RCU-protected list version |
8 | */ | 8 | */ |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | #include <linux/rcupdate.h> | ||
10 | 11 | ||
11 | /* | 12 | /* |
12 | * Insert a new entry between two known consecutive entries. | 13 | * Insert a new entry between two known consecutive entries. |
@@ -19,9 +20,8 @@ static inline void __list_add_rcu(struct list_head *new, | |||
19 | { | 20 | { |
20 | new->next = next; | 21 | new->next = next; |
21 | new->prev = prev; | 22 | new->prev = prev; |
22 | smp_wmb(); | 23 | rcu_assign_pointer(prev->next, new); |
23 | next->prev = new; | 24 | next->prev = new; |
24 | prev->next = new; | ||
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
@@ -110,9 +110,8 @@ static inline void list_replace_rcu(struct list_head *old, | |||
110 | { | 110 | { |
111 | new->next = old->next; | 111 | new->next = old->next; |
112 | new->prev = old->prev; | 112 | new->prev = old->prev; |
113 | smp_wmb(); | 113 | rcu_assign_pointer(new->prev->next, new); |
114 | new->next->prev = new; | 114 | new->next->prev = new; |
115 | new->prev->next = new; | ||
116 | old->prev = LIST_POISON2; | 115 | old->prev = LIST_POISON2; |
117 | } | 116 | } |
118 | 117 | ||
@@ -166,8 +165,7 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
166 | */ | 165 | */ |
167 | 166 | ||
168 | last->next = at; | 167 | last->next = at; |
169 | smp_wmb(); | 168 | rcu_assign_pointer(head->next, first); |
170 | head->next = first; | ||
171 | first->prev = head; | 169 | first->prev = head; |
172 | at->prev = last; | 170 | at->prev = last; |
173 | } | 171 | } |
@@ -280,10 +278,9 @@ static inline void hlist_replace_rcu(struct hlist_node *old, | |||
280 | 278 | ||
281 | new->next = next; | 279 | new->next = next; |
282 | new->pprev = old->pprev; | 280 | new->pprev = old->pprev; |
283 | smp_wmb(); | 281 | rcu_assign_pointer(*new->pprev, new); |
284 | if (next) | 282 | if (next) |
285 | new->next->pprev = &new->next; | 283 | new->next->pprev = &new->next; |
286 | *new->pprev = new; | ||
287 | old->pprev = LIST_POISON2; | 284 | old->pprev = LIST_POISON2; |
288 | } | 285 | } |
289 | 286 | ||
@@ -310,12 +307,12 @@ static inline void hlist_add_head_rcu(struct hlist_node *n, | |||
310 | struct hlist_head *h) | 307 | struct hlist_head *h) |
311 | { | 308 | { |
312 | struct hlist_node *first = h->first; | 309 | struct hlist_node *first = h->first; |
310 | |||
313 | n->next = first; | 311 | n->next = first; |
314 | n->pprev = &h->first; | 312 | n->pprev = &h->first; |
315 | smp_wmb(); | 313 | rcu_assign_pointer(h->first, n); |
316 | if (first) | 314 | if (first) |
317 | first->pprev = &n->next; | 315 | first->pprev = &n->next; |
318 | h->first = n; | ||
319 | } | 316 | } |
320 | 317 | ||
321 | /** | 318 | /** |
@@ -341,9 +338,8 @@ static inline void hlist_add_before_rcu(struct hlist_node *n, | |||
341 | { | 338 | { |
342 | n->pprev = next->pprev; | 339 | n->pprev = next->pprev; |
343 | n->next = next; | 340 | n->next = next; |
344 | smp_wmb(); | 341 | rcu_assign_pointer(*(n->pprev), n); |
345 | next->pprev = &n->next; | 342 | next->pprev = &n->next; |
346 | *(n->pprev) = n; | ||
347 | } | 343 | } |
348 | 344 | ||
349 | /** | 345 | /** |
@@ -369,8 +365,7 @@ static inline void hlist_add_after_rcu(struct hlist_node *prev, | |||
369 | { | 365 | { |
370 | n->next = prev->next; | 366 | n->next = prev->next; |
371 | n->pprev = &prev->next; | 367 | n->pprev = &prev->next; |
372 | smp_wmb(); | 368 | rcu_assign_pointer(prev->next, n); |
373 | prev->next = n; | ||
374 | if (n->next) | 369 | if (n->next) |
375 | n->next->pprev = &n->next; | 370 | n->next->pprev = &n->next; |
376 | } | 371 | } |