[Commits] Rev 4045: MDEV-5766 - my_atomic_load does memory writes in lp:maria/10.0

Sergey Vojtovich svoj at mariadb.org
Tue Mar 11 08:52:21 EET 2014


At lp:maria/10.0

------------------------------------------------------------
revno: 4045
revision-id: svoj at mariadb.org-20140307074306-blf3begv8ee0tb5j
parent: elenst at wheezy-64.home-20140310200353-to4628vx9zpwadav
committer: Sergey Vojtovich <svoj at mariadb.org>
branch nick: 10.0
timestamp: Fri 2014-03-07 11:43:06 +0400
message:
  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.
=== modified file 'include/atomic/gcc_builtins.h'
--- a/include/atomic/gcc_builtins.h	2011-06-30 15:46:53 +0000
+++ b/include/atomic/gcc_builtins.h	2014-03-07 07:43:06 +0000
@@ -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)                    \



More information about the commits mailing list