History

Documentation/memory-barriers: Fix typos

SeongJae Park committed 6 years ago

Commit 8149b5c1 parent 9671f301 file · +4 −4Browse files

Unified · Split

Documentation/memory-barriers.txt+4−4
@@ -185,7 +185,7 @@ As a further example, consider this sequence of events: · 184 unmodified lines
185 =============== ===============185 =============== ===============
186 { A == 1, B == 2, C == 3, P == &A, Q == &C }186 { A == 1, B == 2, C == 3, P == &A, Q == &C }
187 B = 4; Q = P;187 B = 4; Q = P;
188 P = &B D = *Q;188 P = &B; D = *Q;
189 189
190There is an obvious data dependency here, as the value loaded into D depends on190There is an obvious data dependency here, as the value loaded into D depends on
191the address retrieved from P by CPU 2. At the end of the sequence, any of the191the address retrieved from P by CPU 2. At the end of the sequence, any of the
@@ -569,7 +569,7 @@ following sequence of events: · 377 unmodified lines
569 { A == 1, B == 2, C == 3, P == &A, Q == &C }569 { A == 1, B == 2, C == 3, P == &A, Q == &C }
570 B = 4;570 B = 4;
571 <write barrier>571 <write barrier>
572 WRITE_ONCE(P, &B)572 WRITE_ONCE(P, &B);
573 Q = READ_ONCE(P);573 Q = READ_ONCE(P);
574 D = *Q;574 D = *Q;
575 575
@@ -1721,7 +1721,7 @@ of optimizations: · 1145 unmodified lines
1721 and WRITE_ONCE() are more selective: With READ_ONCE() and1721 and WRITE_ONCE() are more selective: With READ_ONCE() and
1722 WRITE_ONCE(), the compiler need only forget the contents of the1722 WRITE_ONCE(), the compiler need only forget the contents of the
1723 indicated memory locations, while with barrier() the compiler must1723 indicated memory locations, while with barrier() the compiler must
1724 discard the value of all memory locations that it has currented1724 discard the value of all memory locations that it has currently
1725 cached in any machine registers. Of course, the compiler must also1725 cached in any machine registers. Of course, the compiler must also
1726 respect the order in which the READ_ONCE()s and WRITE_ONCE()s occur,1726 respect the order in which the READ_ONCE()s and WRITE_ONCE()s occur,
1727 though the CPU of course need not do so.1727 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 · 105 unmodified lines
1833to issue the loads in the correct order (eg. `a[b]` would have to load1833to issue the loads in the correct order (eg. `a[b]` would have to load
1834the value of b before loading a[b]), however there is no guarantee in1834the value of b before loading a[b]), however there is no guarantee in
1835the C specification that the compiler may not speculate the value of b1835the 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)
1837tmp = a[b]; ). There is also the problem of a compiler reloading b after1837tmp = a[b]; ). There is also the problem of a compiler reloading b after
1838having loaded a[b], thus having a newer copy of b than a[b]. A consensus1838having loaded a[b], thus having a newer copy of b than a[b]. A consensus
1839has not yet been reached about these problems, however the READ_ONCE()1839has not yet been reached about these problems, however the READ_ONCE()