MEDIUM: atomic: simplify the atomic load/store/exchange operations
authorWilly Tarreau <w@1wt.eu>
Thu, 15 Jul 2021 12:48:21 +0000 (14:48 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 1 Aug 2021 15:34:06 +0000 (17:34 +0200)
commitcb0451146f2ce4bf8a93890c403262b5308608a4
tree79b27cb5cfe197d9d71920f701c713cadf401f8f
parent55a0975b1e957e9e23df8d9dd5400b40455c3fa9
MEDIUM: atomic: simplify the atomic load/store/exchange operations

The atomic_load/atomic_store/atomic_xchg operations were all forced to
__ATOMIC_SEQ_CST, which results in explicit store or even full barriers
even on x86-tso while we do not need them: we're not communicating with
external devices for example and are only interested in respecting the
proper ordering of loads and stores between each other.

These ones being rarely used, the emitted code on x86 remains almost the
same (barring a handful of locations). However they will allow to place
correct barriers at other places where atomics are accessed a bit lightly.

The patch is marked medium because we can never rule out the risk of some
bugs on more relaxed platforms due to the rest of the code.
include/haproxy/atomic.h