aboutsummaryrefslogtreecommitdiff
path: root/include/linux/idr.h
diff options
context:
space:
mode:
authorNadia Derbey <Nadia.Derbey@bull.net>2008-07-25 01:48:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-25 10:53:42 -0700
commitf9c46d6ea5ce138a886c3a0f10a46130afab75f5 (patch)
tree1eedc2428866fb0b3f9f864e52ffb6eaf00911a4 /include/linux/idr.h
parent3219b3b7456d5cf15ba7b1fe7b1bcf15ce8840e2 (diff)
idr: make idr_find rcu-safe
Make idr_find rcu-safe: it can now be called inside an rcu_read critical section. Signed-off-by: Nadia Derbey <Nadia.Derbey@bull.net> Reviewed-by: "Paul E. McKenney" <paulmck@us.ibm.com> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Jim Houston <jim.houston@comcast.net> Cc: Pierre Peiffer <peifferp@gmail.com> Acked-by: Rik van Riel <riel@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/idr.h')
-rw-r--r--include/linux/idr.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 762c3f2c631d..fa035f96f2a3 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -79,6 +79,22 @@ struct idr {
#define _idr_rc_to_errno(rc) ((rc) == -1 ? -EAGAIN : -ENOSPC)
+/**
+ * idr synchronization (stolen from radix-tree.h)
+ *
+ * idr_find() is able to be called locklessly, using RCU. The caller must
+ * ensure calls to this function are made within rcu_read_lock() regions.
+ * Other readers (lock-free or otherwise) and modifications may be running
+ * concurrently.
+ *
+ * It is still required that the caller manage the synchronization and
+ * lifetimes of the items. So if RCU lock-free lookups are used, typically
+ * this would mean that the items have their own locks, or are amenable to
+ * lock-free access; and that the items are freed by RCU (or only freed after
+ * having been deleted from the idr tree *and* a synchronize_rcu() grace
+ * period).
+ */
+
/*
* This is what we export.
*/