Skip to content

Commit 8dbc33b

Browse files
paulmckrcufbq
authored andcommitted
doc: Make whatisRCU.rst note that spinlocks are RCU readers
In kernels built with CONFIG_PREEMPT_RT=n, spinlock critical sections are RCU readers because they disable preemption. However, they are also RCU readers in CONFIG_PREEMPT_RT=y because in that case the locking primitives contain rcu_read_lock() and rcu_read_unlock(). Therefore, upgrade whatisRCU.rst to document this non-obvious case. Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
1 parent 120311a commit 8dbc33b

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Documentation/RCU/whatisRCU.rst

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,25 @@ rcu_read_lock()
172172
critical section. Reference counts may be used in conjunction
173173
with RCU to maintain longer-term references to data structures.
174174

175+
Note that anything that disables bottom halves, preemption,
176+
or interrupts also enters an RCU read-side critical section.
177+
Acquiring a spinlock also enters an RCU read-side critical
178+
sections, even for spinlocks that do not disable preemption,
179+
as is the case in kernels built with CONFIG_PREEMPT_RT=y.
180+
Sleeplocks do *not* enter RCU read-side critical sections.
181+
175182
rcu_read_unlock()
176183
^^^^^^^^^^^^^^^^^
177184
void rcu_read_unlock(void);
178185

179186
This temporal primitives is used by a reader to inform the
180187
reclaimer that the reader is exiting an RCU read-side critical
181-
section. Note that RCU read-side critical sections may be nested
182-
and/or overlapping.
188+
section. Anything that enables bottom halves, preemption,
189+
or interrupts also exits an RCU read-side critical section.
190+
Releasing a spinlock also exits an RCU read-side critical section.
191+
192+
Note that RCU read-side critical sections may be nested and/or
193+
overlapping.
183194

184195
synchronize_rcu()
185196
^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)