Skip to content

Commit 1566bf4

Browse files
joelagnelpaulmckrcu
authored andcommitted
docs: memory-barriers: Add note on compiler transformation and address deps
The compiler has the ability to cause misordering by destroying address-dependency barriers if comparison operations are used. Add a note about this to memory-barriers.txt in the beginning of both the historical address-dependency sections and point to rcu-dereference.rst for more information. Signed-off-by: Joel Fernandes (Google) <[email protected]> Cc: Alan Stern <[email protected]> Cc: Will Deacon <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: David Howells <[email protected]> Cc: Jade Alglave <[email protected]> Cc: Luc Maranget <[email protected]> Cc: Akira Yokosawa <[email protected]> Cc: Daniel Lustig <[email protected]> Cc: Joel Fernandes <[email protected]> Cc: Jonathan Corbet <[email protected]> Reviewed-by: Andrea Parri <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent 0bb80ec commit 1566bf4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Documentation/memory-barriers.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ Memory barriers come in four basic varieties:
396396

397397

398398
(2) Address-dependency barriers (historical).
399+
[!] This section is marked as HISTORICAL: For more up-to-date
400+
information, including how compiler transformations related to pointer
401+
comparisons can sometimes cause problems, see
402+
Documentation/RCU/rcu_dereference.rst.
399403

400404
An address-dependency barrier is a weaker form of read barrier. In the
401405
case where two loads are performed such that the second depends on the
@@ -556,6 +560,9 @@ There are certain things that the Linux kernel memory barriers do not guarantee:
556560

557561
ADDRESS-DEPENDENCY BARRIERS (HISTORICAL)
558562
----------------------------------------
563+
[!] This section is marked as HISTORICAL: For more up-to-date information,
564+
including how compiler transformations related to pointer comparisons can
565+
sometimes cause problems, see Documentation/RCU/rcu_dereference.rst.
559566

560567
As of v4.15 of the Linux kernel, an smp_mb() was added to READ_ONCE() for
561568
DEC Alpha, which means that about the only people who need to pay attention

0 commit comments

Comments
 (0)