From 45c8a36a5519960638a4f331839bb99c1994fd04 Mon Sep 17 00:00:00 2001 From: "Paul E. McKenney" Date: Tue, 2 Jul 2013 15:24:09 -0700 Subject: doc: Fix memory-barrier control-dependency example Each control-dependency example needs its barriers between the "if" condition and the body of the "if" because a control dependency is a dependency induced by a branch. This commit makes the needed adjustment. Reported-by: Yongming Shen Signed-off-by: Paul E. McKenney Reviewed-by: Josh Triplett --- Documentation/memory-barriers.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Documentation/memory-barriers.txt') diff --git a/Documentation/memory-barriers.txt b/Documentation/memory-barriers.txt index fa5d8a9ae205..c8c42e64e953 100644 --- a/Documentation/memory-barriers.txt +++ b/Documentation/memory-barriers.txt @@ -531,9 +531,10 @@ dependency barrier to make it work correctly. Consider the following bit of code: q = &a; - if (p) + if (p) { + q = &b; - + } x = *q; This will not have the desired effect because there is no actual data @@ -542,9 +543,10 @@ attempting to predict the outcome in advance. In such a case what's actually required is: q = &a; - if (p) + if (p) { + q = &b; - + } x = *q; -- cgit v1.2.3