summaryrefslogtreecommitdiff
path: root/storage/innobase/include/srv0mon.h
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-01-22 23:58:52 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-01-26 10:25:33 +0400
commit8389b45b7fa1a2ddab64050b0be3cdb3e1a937c1 (patch)
tree2bcbe5f8bbcdea1311d3f0063828b9715ca177ab /storage/innobase/include/srv0mon.h
parentce0479006523bc72ed6abb703bd1f87ff256fd8a (diff)
downloadmariadb-git-8389b45b7fa1a2ddab64050b0be3cdb3e1a937c1.tar.gz
MDEV-15059 - Misc small InnoDB scalability fixes
Moved mutex locking inside lock_rec_lock(). Moved monitor increment out of mutex. Moved assertions that don't require protection out of mutex. Removed duplicate assertions. Moved duplicate debug injections into lock_rec_lock(). Let monitor updates use relaxed memory order. Return directly without maintaining variables in lock_rec_lock_slow(). Moved lock_rec_lock_fast() body into lock_rec_lock(): saves at least one trx_mutex_enter(), one switch() plus some code was moved out of mutex.
Diffstat (limited to 'storage/innobase/include/srv0mon.h')
-rw-r--r--storage/innobase/include/srv0mon.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index e4034f3a6ff..b91f7c1103b 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -608,8 +608,9 @@ Use MONITOR_INC if appropriate mutex protection exists.
#define MONITOR_ATOMIC_INC_LOW(monitor, enabled) \
if (enabled) { \
ib_uint64_t value; \
- value = my_atomic_add64( \
- (int64*) &MONITOR_VALUE(monitor), 1) + 1; \
+ value = my_atomic_add64_explicit( \
+ (int64*) &MONITOR_VALUE(monitor), 1, \
+ MY_MEMORY_ORDER_RELAXED) + 1; \
/* Note: This is not 100% accurate because of the \
inherent race, we ignore it due to performance. */ \
if (value > (ib_uint64_t) MONITOR_MAX_VALUE(monitor)) { \
@@ -624,8 +625,9 @@ Use MONITOR_DEC if appropriate mutex protection exists.
#define MONITOR_ATOMIC_DEC_LOW(monitor, enabled) \
if (enabled) { \
ib_uint64_t value; \
- value = my_atomic_add64( \
- (int64*) &MONITOR_VALUE(monitor), -1) - 1; \
+ value = my_atomic_add64_explicit( \
+ (int64*) &MONITOR_VALUE(monitor), -1, \
+ MY_MEMORY_ORDER_RELAXED) - 1; \
/* Note: This is not 100% accurate because of the \
inherent race, we ignore it due to performance. */ \
if (value < (ib_uint64_t) MONITOR_MIN_VALUE(monitor)) { \