Skip to content

Commit

Permalink
doc: Emphasize the need for explicit RCU read-side markers
Browse files Browse the repository at this point in the history
This commit updates checklist.rst to emphasize the need for explicit
markers for RCU read-side critical sections.

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
  • Loading branch information
paulmckrcu committed Aug 31, 2022
1 parent 568035b commit 4d2f862
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Documentation/RCU/checklist.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,13 @@ over a rather long period of time, but improvements are always welcome!
As a rough rule of thumb, any dereference of an RCU-protected
pointer must be covered by rcu_read_lock(), rcu_read_lock_bh(),
rcu_read_lock_sched(), or by the appropriate update-side lock.
Disabling of preemption can serve as rcu_read_lock_sched(), but
is less readable and prevents lockdep from detecting locking issues.
Explicit disabling of preemption (preempt_disable(), for example)
can serve as rcu_read_lock_sched(), but is less readable and
prevents lockdep from detecting locking issues.

Please not that you *cannot* rely on code known to be built
only in non-preemptible kernels. Such code can and will break,
especially in kernels built with CONFIG_PREEMPT_COUNT=y.

Letting RCU-protected pointers "leak" out of an RCU read-side
critical section is every bit as bad as letting them leak out
Expand Down

0 comments on commit 4d2f862

Please sign in to comment.