1
+ .. SPDX-License-Identifier: GPL-2.0
2
+
3
+ ========================
1
4
RCU and lockdep checking
5
+ ========================
2
6
3
7
All flavors of RCU have lockdep checking available, so that lockdep is
4
8
aware of when each task enters and leaves any flavor of RCU read-side
@@ -8,7 +12,7 @@ tracking to include RCU state, which can sometimes help when debugging
8
12
deadlocks and the like.
9
13
10
14
In addition, RCU provides the following primitives that check lockdep's
11
- state:
15
+ state::
12
16
13
17
rcu_read_lock_held() for normal RCU.
14
18
rcu_read_lock_bh_held() for RCU-bh.
@@ -63,7 +67,7 @@ checking of rcu_dereference() primitives:
63
67
The rcu_dereference_check() check expression can be any boolean
64
68
expression, but would normally include a lockdep expression. However,
65
69
any boolean expression can be used. For a moderately ornate example,
66
- consider the following:
70
+ consider the following::
67
71
68
72
file = rcu_dereference_check(fdt->fd[fd],
69
73
lockdep_is_held(&files->file_lock) ||
@@ -82,7 +86,7 @@ RCU read-side critical sections, in case (2) the ->file_lock prevents
82
86
any change from taking place, and finally, in case (3) the current task
83
87
is the only task accessing the file_struct, again preventing any change
84
88
from taking place. If the above statement was invoked only from updater
85
- code, it could instead be written as follows:
89
+ code, it could instead be written as follows::
86
90
87
91
file = rcu_dereference_protected(fdt->fd[fd],
88
92
lockdep_is_held(&files->file_lock) ||
@@ -105,7 +109,7 @@ false and they are called from outside any RCU read-side critical section.
105
109
106
110
For example, the workqueue for_each_pwq() macro is intended to be used
107
111
either within an RCU read-side critical section or with wq->mutex held.
108
- It is thus implemented as follows:
112
+ It is thus implemented as follows::
109
113
110
114
#define for_each_pwq(pwq, wq)
111
115
list_for_each_entry_rcu((pwq), &(wq)->pwqs, pwqs_node,
0 commit comments