summaryrefslogtreecommitdiff
path: root/configure.cmake
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-06-27 10:53:18 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-06-27 10:53:18 +0300
commit042fc2959705eba79b2eae6031d5f9ca5c454c01 (patch)
tree939ae0ae22856c8b4804f84f2f5438640c8cc35b /configure.cmake
parent620f4f8af98666e2efb7e14fb2663ab85b52bc12 (diff)
downloadmariadb-git-042fc2959705eba79b2eae6031d5f9ca5c454c01.tar.gz
MDEV-19845: Adaptive spin loops
Starting with the Intel Skylake microarchitecture, the PAUSE instruction latency is about 140 clock cycles instead of earlier 10. On AMD processors, the latency could be 10 or 50 clock cycles, depending on microarchitecture. Because of this big range of latency, let us scale the loops around the PAUSE instruction based on timing results at server startup. my_cpu_relax_multiplier: New variable: How many times to invoke PAUSE in a loop. Only defined for IA-32 and AMD64. my_cpu_init(): Determine with RDTSC the time to run 16 PAUSE instructions in two unrolled loops according, and based on the quicker of the two runs, initialize my_cpu_relax_multiplier. This form of calibration was suggested by Mikhail Sinyavin from Intel. LF_BACKOFF(), ut_delay(): Use my_cpu_relax_multiplier when available. ut_delay(): Define inline in my_cpu.h. UT_COMPILER_BARRIER(): Remove. This does not seem to have any effect, because in our ut_delay() implementation, no computations are being performed inside the loop. The purpose of UT_COMPILER_BARRIER() was to prohibit the compiler from reordering computations. It was not emitting any code.
Diffstat (limited to 'configure.cmake')
-rw-r--r--configure.cmake26
1 files changed, 0 insertions, 26 deletions
diff --git a/configure.cmake b/configure.cmake
index 67ed6503e3e..e75810f8150 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -758,32 +758,6 @@ IF(NOT C_HAS_inline)
ENDIF()
ENDIF()
-IF(NOT CMAKE_CROSSCOMPILING AND NOT MSVC)
- STRING(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} processor)
- IF(processor MATCHES "86" OR processor MATCHES "amd64" OR processor MATCHES "x64")
- #Check for x86 PAUSE instruction
- # We have to actually try running the test program, because of a bug
- # in Solaris on x86_64, where it wrongly reports that PAUSE is not
- # supported when trying to run an application. See
- # http://bugs.opensolaris.org/bugdatabase/printableBug.do?bug_id=6478684
- CHECK_C_SOURCE_RUNS("
- int main()
- {
- __asm__ __volatile__ (\"pause\");
- return 0;
- }" HAVE_PAUSE_INSTRUCTION)
- ENDIF()
- IF (NOT HAVE_PAUSE_INSTRUCTION)
- CHECK_C_SOURCE_COMPILES("
- int main()
- {
- __asm__ __volatile__ (\"rep; nop\");
- return 0;
- }
- " HAVE_FAKE_PAUSE_INSTRUCTION)
- ENDIF()
-ENDIF()
-
CHECK_SYMBOL_EXISTS(tcgetattr "termios.h" HAVE_TCGETATTR 1)
#