aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Arcangeli <[email protected]>2008-07-28 15:46:22 -0700
committerLinus Torvalds <[email protected]>2008-07-28 16:30:20 -0700
commit6beeac76f5f96590fb751af5e138fbc3f62e8460 (patch)
tree530b768655b63893f019204fe4f9b8405db07ac2
parent93686ae8357c1b1e37e8dfc96547f807e7a93b4b (diff)
mmu-notifiers: add list_del_init_rcu()
Introduce list_del_init_rcu() and document it. Signed-off-by: Andrea Arcangeli <[email protected]> Acked-by: Linus Torvalds <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Jack Steiner <[email protected]> Cc: Robin Holt <[email protected]> Cc: Nick Piggin <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Kanoj Sarcar <[email protected]> Cc: Roland Dreier <[email protected]> Cc: Steve Wise <[email protected]> Cc: Avi Kivity <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Anthony Liguori <[email protected]> Cc: Chris Wright <[email protected]> Cc: Marcelo Tosatti <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Izik Eidus <[email protected]> Cc: Anthony Liguori <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--include/linux/rculist.h28
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)
}
/**
+ * hlist_del_init_rcu - deletes entry from hash list with re-initialization
+ * @n: the element to delete from the hash list.
+ *
+ * Note: list_unhashed() on the node return true after this. It is
+ * useful for RCU based read lockfree traversal if the writer side
+ * must know if the list entry is still hashed or already unhashed.
+ *
+ * In particular, it means that we can not poison the forward pointers
+ * that may still be used for walking the hash list and we can only
+ * zero the pprev pointer so list_unhashed() will return true after
+ * this.
+ *
+ * The caller must take whatever precautions are necessary (such as
+ * holding appropriate locks) to avoid racing with another
+ * list-mutation primitive, such as hlist_add_head_rcu() or
+ * hlist_del_rcu(), running on this same list. However, it is
+ * perfectly legal to run concurrently with the _rcu list-traversal
+ * primitives, such as hlist_for_each_entry_rcu().
+ */
+static inline void hlist_del_init_rcu(struct hlist_node *n)
+{
+ if (!hlist_unhashed(n)) {
+ __hlist_del(n);
+ n->pprev = NULL;
+ }
+}
+
+/**
* list_replace_rcu - replace old entry by new one
* @old : the element to be replaced
* @new : the new element to insert