MINOR: atomic: add a read-specific variant of __ha_cpu_relax()
authorWilly Tarreau <w@1wt.eu>
Fri, 15 Mar 2024 16:31:35 +0000 (17:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 25 Mar 2024 17:34:19 +0000 (17:34 +0000)
commitc038ca8e8cfd4e1793f3dc1cbe0bd4bdf0fcb645
treeeff8aeaf1ebfcec8a66bdfc44bf0eac977a04f99
parent5df0df96dd53da7a8e86fc32afbb27650448e6ac
MINOR: atomic: add a read-specific variant of __ha_cpu_relax()

Tests on various systems show that x86 prefers not to wait at all inside
read loops while aarch64 prefers to wait a little bit. Instead of having
to stuff ifdefs around __ha_cpu_relax() inside plenty of such loops
waiting for a condition to appear, better implement a new variant that
we call __ha_cpu_relax_for_read() which honors each architecture's
preferences and is the same as __ha_cpu_relax() for other ones.
include/haproxy/atomic.h