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

documentation: Record rcu_dereference() value mishandling

Recent LKML discussings (see http://lwn.net/Articles/586838/ and
http://lwn.net/Articles/588300/ for the LWN writeups) brought out
some ways of misusing the return value from rcu_dereference() that
are not necessarily completely intuitive.  This commit therefore
documents what can and cannot safely be done with these values.
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
parent 96224daa
...@@ -12,6 +12,8 @@ lockdep-splat.txt ...@@ -12,6 +12,8 @@ lockdep-splat.txt
- RCU Lockdep splats explained. - RCU Lockdep splats explained.
NMI-RCU.txt NMI-RCU.txt
- Using RCU to Protect Dynamic NMI Handlers - Using RCU to Protect Dynamic NMI Handlers
rcu_dereference.txt
- Proper care and feeding of return values from rcu_dereference()
rcubarrier.txt rcubarrier.txt
- RCU and Unloadable Modules - RCU and Unloadable Modules
rculist_nulls.txt rculist_nulls.txt
......
...@@ -114,12 +114,16 @@ over a rather long period of time, but improvements are always welcome! ...@@ -114,12 +114,16 @@ over a rather long period of time, but improvements are always welcome!
http://www.openvms.compaq.com/wizard/wiz_2637.html http://www.openvms.compaq.com/wizard/wiz_2637.html
The rcu_dereference() primitive is also an excellent The rcu_dereference() primitive is also an excellent
documentation aid, letting the person reading the code documentation aid, letting the person reading the
know exactly which pointers are protected by RCU. code know exactly which pointers are protected by RCU.
Please note that compilers can also reorder code, and Please note that compilers can also reorder code, and
they are becoming increasingly aggressive about doing they are becoming increasingly aggressive about doing
just that. The rcu_dereference() primitive therefore just that. The rcu_dereference() primitive therefore also
also prevents destructive compiler optimizations. prevents destructive compiler optimizations. However,
with a bit of devious creativity, it is possible to
mishandle the return value from rcu_dereference().
Please see rcu_dereference.txt in this directory for
more information.
The rcu_dereference() primitive is used by the The rcu_dereference() primitive is used by the
various "_rcu()" list-traversal primitives, such various "_rcu()" list-traversal primitives, such
......
This diff is collapsed.
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