]> git.baikalelectronics.ru Git - 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)
commit98f11d932a3b880110a6e66d9f07a0be6af90701
tree0f68be2e8a0307f0ad918c3dec016e009f1c64f5
parentf9edbd83f688ebc481273355d555874d2c688555
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 fd5beb2636be ("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