summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKrunal Bauskar <mysqlonarm@gmail.com>2021-10-19 14:03:58 +0800
committerMarko Mäkelä <marko.makela@mariadb.com>2021-10-19 09:28:18 +0300
commitf7684f0ca5f6f53d63e93afe89194b43bb5431d2 (patch)
tree875089982f31c9c437796482b467f3e2069e0667
parentc3c53926c467c95386ae98d61ada87294bd61478 (diff)
downloadmariadb-git-f7684f0ca5f6f53d63e93afe89194b43bb5431d2.tar.gz
MDEV-26855: Enable spinning for log_sys_mutex and log_flush_order_mutex
As part of MDEV-26779 we first discovered the effect of enabling spinning for some critical mutex. MDEV-26779 tried enabling it for lock_sys.wait_mutex and observed a good gain in performance. In yet another discussion, Mark Callaghan pointed a reference to pthread based mutex spin using PTHREAD_MUTEX_ADAPTIVE_NP (MDEV-26769 Intel RTM). Given the strong references, Marko Makela as part of his comment in #1923 pointed an idea to enable spinning for other mutexes. Based on perf profiling we decided to explore spinning for log_sys_mutex and log_flush_order_mutex as they are occupying the top slots in the contented mutex list. The evaluation showed promising results for ARM64 but not for x86. So a patch is here-by proposed to enable the spinning of the mutex for ARM64-based platform.
-rw-r--r--storage/innobase/log/log0log.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index b2fa2e735f9..efacd520d52 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -175,8 +175,14 @@ void log_t::create()
ut_ad(!is_initialised());
m_initialised= true;
+#if defined(__aarch64__)
+ mysql_mutex_init(log_sys_mutex_key, &mutex, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(
+ log_flush_order_mutex_key, &flush_order_mutex, MY_MUTEX_INIT_FAST);
+#else
mysql_mutex_init(log_sys_mutex_key, &mutex, nullptr);
mysql_mutex_init(log_flush_order_mutex_key, &flush_order_mutex, nullptr);
+#endif
/* Start the lsn from one log block from zero: this way every
log record has a non-zero start lsn, a fact which we will use */