]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()
authorWill Deacon <will@kernel.org>
Mon, 16 Dec 2019 16:51:45 +0000 (16:51 +0000)
committerWill Deacon <will@kernel.org>
Thu, 16 Apr 2020 11:20:33 +0000 (12:20 +0100)
commita5460b5e5fb82656807840d40d3deaecad094044
tree0f68be2e8a0307f0ad918c3dec016e009f1c64f5
parentc6a771d932332568df9f46a3b53507c578e8c8e8
READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE()

The implementations of {READ,WRITE}_ONCE() suffer from a significant
amount of indirection and complexity due to a historic GCC bug:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145

which was originally worked around by 230fa253df63 ("kernel: Provide
READ_ONCE and ASSIGN_ONCE").

Since GCC 4.8 is fairly vintage at this point and we emit a warning if
we detect it during the build, return {READ,WRITE}_ONCE() to their former
glory with an implementation that is easier to understand and, crucially,
more amenable to optimisation. A side effect of this simplification is
that WRITE_ONCE() no longer returns a value, but nobody seems to be
relying on that and the new behaviour is aligned with smp_store_release().

Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Will Deacon <will@kernel.org>
include/linux/compiler.h