summaryrefslogtreecommitdiffstats
path: root/Documentation/memory-barriers.txt
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2015-12-29 19:23:18 -0500
committerPaul E. McKenney <paulmck@linux.vnet.ibm.com>2016-03-14 18:52:16 -0400
commit7817b799ed6b270fbf7f2b30efd0ae011dfc9644 (patch)
tree6f83b4f9f823160fb20b6896ea7f3be7d6fdb633 /Documentation/memory-barriers.txt
parent92e963f50fc74041b5e9e744c330dca48e04f08d (diff)
documentation: Fix control dependency and identical stores
The summary of the "CONTROL DEPENDENCIES" section incorrectly states that barrier() may be used to prevent compiler reordering when more than one leg of the control-dependent "if" statement start with identical stores. This is incorrect at high optimization levels. This commit therefore updates the summary to match the detailed description. Reported by: Jianyu Zhan <nasa4836@gmail.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'Documentation/memory-barriers.txt')
-rw-r--r--Documentation/memory-barriers.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt
index 904ee42d078e..e26058d3e253 100644
--- a/Documentation/memory-barriers.txt
+++ b/Documentation/memory-barriers.txt
@@ -800,9 +800,13 @@ In summary:
800 use smp_rmb(), smp_wmb(), or, in the case of prior stores and 800 use smp_rmb(), smp_wmb(), or, in the case of prior stores and
801 later loads, smp_mb(). 801 later loads, smp_mb().
802 802
803 (*) If both legs of the "if" statement begin with identical stores 803 (*) If both legs of the "if" statement begin with identical stores to
804 to the same variable, a barrier() statement is required at the 804 the same variable, then those stores must be ordered, either by
805 beginning of each leg of the "if" statement. 805 preceding both of them with smp_mb() or by using smp_store_release()
806 to carry out the stores. Please note that it is -not- sufficient
807 to use barrier() at beginning of each leg of the "if" statement,
808 as optimizing compilers do not necessarily respect barrier()
809 in this case.
806 810
807 (*) Control dependencies require at least one run-time conditional 811 (*) Control dependencies require at least one run-time conditional
808 between the prior load and the subsequent store, and this 812 between the prior load and the subsequent store, and this