Re: [PATCH v3 3/3] arm64, compiler-context-analysis: Permit alias analysis through __READ_ONCE() with CONFIG_LTO=y
From: Linus Torvalds
Date: Mon Feb 16 2026 - 10:36:54 EST
On Mon, 16 Feb 2026 at 03:09, David Laight <david.laight.linux@xxxxxxxxx> wrote:
>
> volatile structure members are almost free
No, gcc does absolutely horrible things with volatiles. It disables a
lot of very basic stuff.
Try doing something as simple as a "var++" on a volatile, and cry.
We need to have explicit 'READ_ONCE()' etc atomic accesses, just to
make it very very clear that the compiler will generate shit code.
We do *not* hide them and make them implicit by marking data
structures volatile. I very much want those explicit
READ_ONCE/WRITE_ONCE cases.
Linus