Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

doc: Spinlocks are implied 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 the -rt locking primitives
contain rcu_read_lock() and rcu_read_unlock(). Therefore, upgrade
rcu_dereference.rst to document this non-obvious case.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Closes: https://lore.kernel.org/lkml/CAHk-=whGKvjHCtJ6W4pQ0_h_k9fiFQ8V2GpM=BqYnB2X=SJ+XQ@mail.gmail.com/
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>

authored by

Paul E. McKenney and committed by
Boqun Feng
120311ac 41bccc98

+4 -1
+4 -1
Documentation/RCU/rcu_dereference.rst
··· 408 408 RCU flavors, an RCU read-side critical section is entered 409 409 using rcu_read_lock(), anything that disables bottom halves, 410 410 anything that disables interrupts, or anything that disables 411 - preemption. 411 + preemption. Please note that spinlock critical sections 412 + are also implied RCU read-side critical sections, even when 413 + they are preemptible, as they are in kernels built with 414 + CONFIG_PREEMPT_RT=y. 412 415 413 416 2. If the access might be within an RCU read-side critical section 414 417 on the one hand, or protected by (say) my_lock on the other,