diff options
author | pierre Kuo <vichy.kuo@gmail.com> | 2017-04-07 08:37:36 +0200 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2017-04-12 17:23:43 +0200 |
commit | b26cfc48e3e03126c183f1f3960e6d69460bb852 (patch) | |
tree | ea7929ee20ba916595758350c958d1d81594d1e6 /kernel | |
parent | doc: Emphasize that "toy" RCU requires recursive rwlock (diff) | |
download | linux-b26cfc48e3e03126c183f1f3960e6d69460bb852.tar.xz linux-b26cfc48e3e03126c183f1f3960e6d69460bb852.zip |
doc: Update control-dependencies section of memory-barriers.txt
In the following example, if MAX is defined to be 1, then the compiler
knows (Q % MAX) is equal to zero. The compiler can therefore throw
away the "then" branch (and the "if"), retaining only the "else" branch.
q = READ_ONCE(a);
if (q % MAX) {
WRITE_ONCE(b, 1);
do_something();
} else {
WRITE_ONCE(b, 2);
do_something_else();
}
It is therefore necessary to modify the example like this:
q = READ_ONCE(a);
- WRITE_ONCE(b, 1);
+ WRITE_ONCE(b, 2);
do_something_else();
Signed-off-by: pierre Kuo <vichy.kuo@gmail.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions