@@ -185,7 +185,7 @@ As a further example, consider this sequence of events:
185185 =============== ===============
186186 { A == 1, B == 2, C == 3, P == &A, Q == &C }
187187 B = 4; Q = P;
188- P = &B D = *Q;
188+ P = &B; D = *Q;
189189
190190There is an obvious data dependency here, as the value loaded into D depends on
191191the address retrieved from P by CPU 2. At the end of the sequence, any of the
@@ -569,7 +569,7 @@ following sequence of events:
569569 { A == 1, B == 2, C == 3, P == &A, Q == &C }
570570 B = 4;
571571 <write barrier>
572- WRITE_ONCE(P, &B)
572+ WRITE_ONCE(P, &B);
573573 Q = READ_ONCE(P);
574574 D = *Q;
575575
@@ -1721,7 +1721,7 @@ of optimizations:
17211721 and WRITE_ONCE() are more selective: With READ_ONCE() and
17221722 WRITE_ONCE(), the compiler need only forget the contents of the
17231723 indicated memory locations, while with barrier() the compiler must
1724- discard the value of all memory locations that it has currented
1724+ discard the value of all memory locations that it has currently
17251725 cached in any machine registers. Of course, the compiler must also
17261726 respect the order in which the READ_ONCE()s and WRITE_ONCE()s occur,
17271727 though the CPU of course need not do so.
@@ -1833,7 +1833,7 @@ Aside: In the case of data dependencies, the compiler would be expected
18331833to issue the loads in the correct order (eg. `a[b]` would have to load
18341834the value of b before loading a[b]), however there is no guarantee in
18351835the C specification that the compiler may not speculate the value of b
1836- (eg. is equal to 1) and load a before b (eg. tmp = a[1]; if (b != 1)
1836+ (eg. is equal to 1) and load a[b] before b (eg. tmp = a[1]; if (b != 1)
18371837tmp = a[b]; ). There is also the problem of a compiler reloading b after
18381838having loaded a[b], thus having a newer copy of b than a[b]. A consensus
18391839has not yet been reached about these problems, however the READ_ONCE()
0 commit comments