]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
doc: Make whatisRCU.rst note that spinlocks are RCU readers
authorPaul E. McKenney <paulmck@kernel.org>
Fri, 24 Nov 2023 23:06:46 +0000 (15:06 -0800)
committerBoqun Feng <boqun.feng@gmail.com>
Wed, 14 Feb 2024 15:53:49 +0000 (07:53 -0800)
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>
Documentation/RCU/whatisRCU.rst

index 60ce02475142d881b0238f67eee5b9306830745e..246ce0d0b4d116427a0f621b38c291f1072a22cf 100644 (file)
@@ -172,14 +172,25 @@ rcu_read_lock()
        critical section.  Reference counts may be used in conjunction
        with RCU to maintain longer-term references to data structures.
 
+       Note that anything that disables bottom halves, preemption,
+       or interrupts also enters an RCU read-side critical section.
+       Acquiring a spinlock also enters an RCU read-side critical
+       sections, even for spinlocks that do not disable preemption,
+       as is the case in kernels built with CONFIG_PREEMPT_RT=y.
+       Sleeplocks do *not* enter RCU read-side critical sections.
+
 rcu_read_unlock()
 ^^^^^^^^^^^^^^^^^
        void rcu_read_unlock(void);
 
        This temporal primitives is used by a reader to inform the
        reclaimer that the reader is exiting an RCU read-side critical
-       section.  Note that RCU read-side critical sections may be nested
-       and/or overlapping.
+       section.  Anything that enables bottom halves, preemption,
+       or interrupts also exits an RCU read-side critical section.
+       Releasing a spinlock also exits an RCU read-side critical section.
+
+       Note that RCU read-side critical sections may be nested and/or
+       overlapping.
 
 synchronize_rcu()
 ^^^^^^^^^^^^^^^^^