diff options
author | Paul E. McKenney <paulmck@kernel.org> | 2020-09-24 20:53:25 -0700 |
---|---|---|
committer | Paul E. McKenney <paulmck@kernel.org> | 2020-11-02 17:07:15 -0800 |
commit | 86b5a7381b12b1d1d5558d8087e5bbd04b7cf702 (patch) | |
tree | c4feed5f8bb666b4e18332112e6710950190fd6a /Documentation/RCU/rcu_dereference.rst | |
parent | 3650b228f83adda7e5ee532e2b90429c03f7b9ec (diff) | |
download | linux-86b5a7381b12b1d1d5558d8087e5bbd04b7cf702.tar.bz2 |
doc: Present the role of READ_ONCE()
This commit adds an explanation of the special cases where READ_ONCE()
may be used in place of a member of the rcu_dereference() family.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Diffstat (limited to 'Documentation/RCU/rcu_dereference.rst')
-rw-r--r-- | Documentation/RCU/rcu_dereference.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/RCU/rcu_dereference.rst b/Documentation/RCU/rcu_dereference.rst index c9667eb0d444..f3e587acb4de 100644 --- a/Documentation/RCU/rcu_dereference.rst +++ b/Documentation/RCU/rcu_dereference.rst @@ -28,6 +28,12 @@ Follow these rules to keep your RCU code working properly: for an example where the compiler can in fact deduce the exact value of the pointer, and thus cause misordering. +- In the special case where data is added but is never removed + while readers are accessing the structure, READ_ONCE() may be used + instead of rcu_dereference(). In this case, use of READ_ONCE() + takes on the role of the lockless_dereference() primitive that + was removed in v4.15. + - You are only permitted to use rcu_dereference on pointer values. The compiler simply knows too much about integral values to trust it to carry dependencies through integer operations. |