]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/idr.h
idr: make idr_find rcu-safe
[linux-2.6-omap-h63xx.git] / include / linux / idr.h
index 762c3f2c631d25c18005277fe5e4ccd2d6694ade..fa035f96f2a3b340c468e4b58d9010df3b21be69 100644 (file)
@@ -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.
  */