diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-31 17:28:37 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-08-31 17:32:41 +0300 |
commit | 83e2176765e75fce41fa33f698131b9a4dd702f9 (patch) | |
tree | 6cd8fbeb78713cd594500c02310943cf1b1827c8 | |
parent | 80e6d07aeeb225ffb416ff4753518865eaa54651 (diff) | |
download | mariadb-git-bb-10.2-marko.tar.gz |
MDEV-23633 UT_RELAX_CPU or MY_RELAX_CPU does unnecessary compare-and-swapbb-10.2-marko
This is a follow-up to MDEV-14374. On target architectures where nothing
special is available (not IA-32, AMD64, POWER), we would perform a
dummy compare-and-swap operation. This is contrary to the idea of the
x86 PAUSE instruction and the __ppc_get_timebase(), which aim to keep
the memory bus idle for a while, to allow other cores to better execute
code while a spinloop is waiting for something to be changed.
-rw-r--r-- | storage/innobase/include/ut0ut.h | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index a19f3db188d..c20a9023458 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -71,12 +71,11 @@ Created 1/20/1994 Heikki Tuuri #elif defined(__powerpc__) && defined __GLIBC__ # include <sys/platform/ppc.h> # define UT_RELAX_CPU() __ppc_get_timebase() +#elif defined __GNUC__ +/* Mainly, prevent the compiler from optimizing away delay loops */ +# define UT_RELAX_CPU() __asm__ __volatile__ ("":::"memory") #else -# define UT_RELAX_CPU() do { \ - volatile int32 volatile_var; \ - int32 oldval= 0; \ - my_atomic_cas32(&volatile_var, &oldval, 1); \ - } while (0) +# define UT_RELAX_CPU() #endif #if defined (__GNUC__) |