summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2020-02-17 19:56:50 +0100
committerVladislav Vaintroub <wlad@mariadb.com>2020-02-17 19:56:50 +0100
commit595db78e0b7dac53d486c87afd0f1be70d2769a3 (patch)
treebb81ab258bda560fa0e8d122a1e46b665aeba94b
parenta5a607154a443d46bea9da082d4792f119b51abd (diff)
downloadmariadb-git-bb-10.5-MDEV-15053.tar.gz
MDEV-15053 : make buf_buddy_stat_t use atomicsbb-10.5-MDEV-15053
-rw-r--r--storage/innobase/handler/i_s.cc5
-rw-r--r--storage/innobase/include/buf0buf.h6
2 files changed, 4 insertions, 7 deletions
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 12d0a7cab9a..230d84b6450 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -1634,7 +1634,6 @@ i_s_cmpmem_fill_low(
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
ulint zip_free_len_local[BUF_BUDDY_SIZES_MAX + 1];
- buf_buddy_stat_t buddy_stat_local[BUF_BUDDY_SIZES_MAX + 1];
/* Save buddy stats for buffer pool in local variables. */
mutex_enter(&buf_pool->mutex);
@@ -1643,8 +1642,6 @@ i_s_cmpmem_fill_low(
zip_free_len_local[x] = (x < BUF_BUDDY_SIZES) ?
UT_LIST_GET_LEN(buf_pool->zip_free[x]) : 0;
- buddy_stat_local[x] = buf_pool->buddy_stat[x];
-
if (reset) {
/* This is protected by buf_pool->mutex. */
buf_pool->buddy_stat[x].relocated = 0;
@@ -1655,7 +1652,7 @@ i_s_cmpmem_fill_low(
mutex_exit(&buf_pool->mutex);
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
- buf_buddy_stat_t* buddy_stat = &buddy_stat_local[x];
+ buf_buddy_stat_t* buddy_stat = &buf_pool->buddy_stat[x];
Field **field = table->field;
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 3432ef12df9..752c51930d6 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1754,11 +1754,11 @@ struct buf_pool_stat_t{
/** Statistics of buddy blocks of a given size. */
struct buf_buddy_stat_t {
/** Number of blocks allocated from the buddy system. */
- ulint used;
+ Atomic_counter<ulint> used;
/** Number of blocks relocated by the buddy system. */
- ib_uint64_t relocated;
+ Atomic_counter<ib_uint64_t> relocated;
/** Total duration of block relocations, in microseconds. */
- ib_uint64_t relocated_usec;
+ Atomic_counter<ib_uint64_t> relocated_usec;
};
/** The buffer pool */