summaryrefslogtreecommitdiff
path: root/Documentation/RCU/lockdep.txt
diff options
context:
space:
mode:
authorJoel Fernandes (Google) <joel@joelfernandes.org>2019-08-12 01:11:10 +0300
committerPaul E. McKenney <paulmck@kernel.org>2019-10-29 12:48:28 +0300
commit45271064e1caccd1ab004bf747f3ff6ef4e4ea8f (patch)
tree655d5345e72fff5e34a37c0503a7337a550a18f4 /Documentation/RCU/lockdep.txt
parent71cb46ae46bda16e766a8957bc68396002767352 (diff)
downloadlinux-45271064e1caccd1ab004bf747f3ff6ef4e4ea8f.tar.xz
doc: Update list_for_each_entry_rcu() documentation
This commit updates the documentation with information about usage of lockdep with list_for_each_entry_rcu(). Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org> [ paulmck: Wordsmithing. ] Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'Documentation/RCU/lockdep.txt')
-rw-r--r--Documentation/RCU/lockdep.txt18
1 files changed, 14 insertions, 4 deletions
diff --git a/Documentation/RCU/lockdep.txt b/Documentation/RCU/lockdep.txt
index da51d3068850..89db949eeca0 100644
--- a/Documentation/RCU/lockdep.txt
+++ b/Documentation/RCU/lockdep.txt
@@ -96,7 +96,17 @@ other flavors of rcu_dereference(). On the other hand, it is illegal
to use rcu_dereference_protected() if either the RCU-protected pointer
or the RCU-protected data that it points to can change concurrently.
-There are currently only "universal" versions of the rcu_assign_pointer()
-and RCU list-/tree-traversal primitives, which do not (yet) check for
-being in an RCU read-side critical section. In the future, separate
-versions of these primitives might be created.
+Like rcu_dereference(), when lockdep is enabled, RCU list and hlist
+traversal primitives check for being called from within an RCU read-side
+critical section. However, a lockdep expression can be passed to them
+as a additional optional argument. With this lockdep expression, these
+traversal primitives will complain only if the lockdep expression is
+false and they are called from outside any RCU read-side critical section.
+
+For example, the workqueue for_each_pwq() macro is intended to be used
+either within an RCU read-side critical section or with wq->mutex held.
+It is thus implemented as follows:
+
+ #define for_each_pwq(pwq, wq)
+ list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node,
+ lock_is_held(&(wq->mutex).dep_map))