diff options
author | Andrea Arcangeli <andrea@qumranet.com> | 2008-07-28 18:46:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-28 19:30:20 -0400 |
commit | 6beeac76f5f96590fb751af5e138fbc3f62e8460 (patch) | |
tree | 530b768655b63893f019204fe4f9b8405db07ac2 | |
parent | 93686ae8357c1b1e37e8dfc96547f807e7a93b4b (diff) |
mmu-notifiers: add list_del_init_rcu()
Introduce list_del_init_rcu() and document it.
Signed-off-by: Andrea Arcangeli <andrea@qumranet.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Christoph Lameter <cl@linux-foundation.org>
Cc: Jack Steiner <steiner@sgi.com>
Cc: Robin Holt <holt@sgi.com>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Kanoj Sarcar <kanojsarcar@yahoo.com>
Cc: Roland Dreier <rdreier@cisco.com>
Cc: Steve Wise <swise@opengridcomputing.com>
Cc: Avi Kivity <avi@qumranet.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Chris Wright <chrisw@redhat.com>
Cc: Marcelo Tosatti <marcelo@kvack.org>
Cc: Eric Dumazet <dada1@cosmosbay.com>
Cc: "Paul E. McKenney" <paulmck@us.ibm.com>
Cc: Izik Eidus <izike@qumranet.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/rculist.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/rculist.h b/include/linux/rculist.h index b0f39be08b6c..eb4443c7e05b 100644 --- a/include/linux/rculist.h +++ b/include/linux/rculist.h | |||
@@ -98,6 +98,34 @@ static inline void list_del_rcu(struct list_head *entry) | |||
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
101 | * hlist_del_init_rcu - deletes entry from hash list with re-initialization | ||
102 | * @n: the element to delete from the hash list. | ||
103 | * | ||
104 | * Note: list_unhashed() on the node return true after this. It is | ||
105 | * useful for RCU based read lockfree traversal if the writer side | ||
106 | * must know if the list entry is still hashed or already unhashed. | ||
107 | * | ||
108 | * In particular, it means that we can not poison the forward pointers | ||
109 | * that may still be used for walking the hash list and we can only | ||
110 | * zero the pprev pointer so list_unhashed() will return true after | ||
111 | * this. | ||
112 | * | ||
113 | * The caller must take whatever precautions are necessary (such as | ||
114 | * holding appropriate locks) to avoid racing with another | ||
115 | * list-mutation primitive, such as hlist_add_head_rcu() or | ||
116 | * hlist_del_rcu(), running on this same list. However, it is | ||
117 | * perfectly legal to run concurrently with the _rcu list-traversal | ||
118 | * primitives, such as hlist_for_each_entry_rcu(). | ||
119 | */ | ||
120 | static inline void hlist_del_init_rcu(struct hlist_node *n) | ||
121 | { | ||
122 | if (!hlist_unhashed(n)) { | ||
123 | __hlist_del(n); | ||
124 | n->pprev = NULL; | ||
125 | } | ||
126 | } | ||
127 | |||
128 | /** | ||
101 | * list_replace_rcu - replace old entry by new one | 129 | * list_replace_rcu - replace old entry by new one |
102 | * @old : the element to be replaced | 130 | * @old : the element to be replaced |
103 | * @new : the new element to insert | 131 | * @new : the new element to insert |