Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45c8a36a authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

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: default avatarYongming Shen <symingz@gmail.com>
Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Reviewed-by: default avatarJosh Triplett <josh@joshtriplett.org>
parent 6ae37718
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -531,9 +531,10 @@ dependency barrier to make it work correctly. Consider the following bit of
code:

	q = &a;
	if (p)
		q = &b;
	if (p) {
		<data dependency barrier>
		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)
		q = &b;
	if (p) {
		<read barrier>
		q = &b;
	}
	x = *q;