Skip to content

Commit f7684f0

Browse files
mysqlonarmdr-m
authored andcommitted
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.
1 parent c3c5392 commit f7684f0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

storage/innobase/log/log0log.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,14 @@ void log_t::create()
175175
ut_ad(!is_initialised());
176176
m_initialised= true;
177177

178+
#if defined(__aarch64__)
179+
mysql_mutex_init(log_sys_mutex_key, &mutex, MY_MUTEX_INIT_FAST);
180+
mysql_mutex_init(
181+
log_flush_order_mutex_key, &flush_order_mutex, MY_MUTEX_INIT_FAST);
182+
#else
178183
mysql_mutex_init(log_sys_mutex_key, &mutex, nullptr);
179184
mysql_mutex_init(log_flush_order_mutex_key, &flush_order_mutex, nullptr);
185+
#endif
180186

181187
/* Start the lsn from one log block from zero: this way every
182188
log record has a non-zero start lsn, a fact which we will use */

0 commit comments

Comments
 (0)