mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
MDEV-5766 - my_atomic_load does memory writes
my_atomic_load() is implemented as __sync_fetch_and_or(var, 0) which writes or-ed value back to var. Memory writes as such have worse performance and scalability than reads. gcc 4.7 and up offers better facility for atomic loads/stores. Use it whenever it is available.
This commit is contained in:
parent
6dda6428d2
commit
9836fd5d13
1 changed files with 6 additions and 0 deletions
|
@ -31,6 +31,12 @@
|
|||
#define make_atomic_store_body(S) *a= v
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-up"
|
||||
|
||||
#elif defined(__ATOMIC_SEQ_CST)
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-smp"
|
||||
#define make_atomic_load_body(S) \
|
||||
ret= __atomic_load_n(a, __ATOMIC_SEQ_CST)
|
||||
#define make_atomic_store_body(S) \
|
||||
__atomic_store_n(a, v, __ATOMIC_SEQ_CST)
|
||||
#else
|
||||
#define MY_ATOMIC_MODE "gcc-builtins-smp"
|
||||
#define make_atomic_load_body(S) \
|
||||
|
|
Loading…
Add table
Reference in a new issue