Commit 43850011 authored by Paul E. McKenney's avatar Paul E. McKenney

doc: Further updates to RCU's lockdep.rst

This commit wordsmiths RCU's lockdep.rst.
Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent 1b929c02
...@@ -69,9 +69,8 @@ checking of rcu_dereference() primitives: ...@@ -69,9 +69,8 @@ checking of rcu_dereference() primitives:
value of the pointer itself, for example, against NULL. value of the pointer itself, for example, against NULL.
The rcu_dereference_check() check expression can be any boolean The rcu_dereference_check() check expression can be any boolean
expression, but would normally include a lockdep expression. However, expression, but would normally include a lockdep expression. For a
any boolean expression can be used. For a moderately ornate example, moderately ornate example, consider the following::
consider the following::
file = rcu_dereference_check(fdt->fd[fd], file = rcu_dereference_check(fdt->fd[fd],
lockdep_is_held(&files->file_lock) || lockdep_is_held(&files->file_lock) ||
...@@ -97,10 +96,10 @@ code, it could instead be written as follows:: ...@@ -97,10 +96,10 @@ code, it could instead be written as follows::
atomic_read(&files->count) == 1); atomic_read(&files->count) == 1);
This would verify cases #2 and #3 above, and furthermore lockdep would This would verify cases #2 and #3 above, and furthermore lockdep would
complain if this was used in an RCU read-side critical section unless one complain even if this was used in an RCU read-side critical section unless
of these two cases held. Because rcu_dereference_protected() omits all one of these two cases held. Because rcu_dereference_protected() omits
barriers and compiler constraints, it generates better code than do the all barriers and compiler constraints, it generates better code than do
other flavors of rcu_dereference(). On the other hand, it is illegal the other flavors of rcu_dereference(). On the other hand, it is illegal
to use rcu_dereference_protected() if either the RCU-protected pointer to use rcu_dereference_protected() if either the RCU-protected pointer
or the RCU-protected data that it points to can change concurrently. or the RCU-protected data that it points to can change concurrently.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment