Skip to content

Commit 8e8e65e

Browse files
committed
MDEV-10829: innodb_numa_interleave=1, use numa numa_get_mems_allowed
Using numa_all_nodes_ptr was excessively optimistic. Due to constraints in systemd, containers or otherwise mysqld could of been limited to a smaller set of cpus. Use the numa_get_mems_allowed library function to see what we can interleave between before doing so. The alternative is to fail interleaving overall. Signed-off-by: Daniel Black <daniel.black@au.ibm.com>
1 parent 8b59eab commit 8e8e65e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

storage/innobase/buf/buf0buf.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,10 +1157,11 @@ buf_chunk_init(
11571157

11581158
#ifdef HAVE_LIBNUMA
11591159
if (srv_numa_interleave) {
1160+
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
11601161
int st = mbind(chunk->mem, chunk->mem_size,
11611162
MPOL_INTERLEAVE,
1162-
numa_all_nodes_ptr->maskp,
1163-
numa_all_nodes_ptr->size,
1163+
numa_mems_allowed->maskp,
1164+
numa_mems_allowed->size,
11641165
MPOL_MF_MOVE);
11651166
if (st != 0) {
11661167
ib_logf(IB_LOG_LEVEL_WARN,
@@ -1551,11 +1552,13 @@ buf_pool_init(
15511552

15521553
#ifdef HAVE_LIBNUMA
15531554
if (srv_numa_interleave) {
1555+
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
1556+
15541557
ib_logf(IB_LOG_LEVEL_INFO,
15551558
"Setting NUMA memory policy to MPOL_INTERLEAVE");
15561559
if (set_mempolicy(MPOL_INTERLEAVE,
1557-
numa_all_nodes_ptr->maskp,
1558-
numa_all_nodes_ptr->size) != 0) {
1560+
numa_mems_allowed->maskp,
1561+
numa_mems_allowed->size) != 0) {
15591562
ib_logf(IB_LOG_LEVEL_WARN,
15601563
"Failed to set NUMA memory policy to"
15611564
" MPOL_INTERLEAVE (error: %s).",

storage/xtradb/buf/buf0buf.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,10 +1235,11 @@ buf_chunk_init(
12351235

12361236
#ifdef HAVE_LIBNUMA
12371237
if (srv_numa_interleave) {
1238+
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
12381239
int st = mbind(chunk->mem, chunk->mem_size,
12391240
MPOL_INTERLEAVE,
1240-
numa_all_nodes_ptr->maskp,
1241-
numa_all_nodes_ptr->size,
1241+
numa_mems_allowed->maskp,
1242+
numa_mems_allowed->size,
12421243
MPOL_MF_MOVE);
12431244
if (st != 0) {
12441245
ib_logf(IB_LOG_LEVEL_WARN,
@@ -1645,11 +1646,13 @@ buf_pool_init(
16451646

16461647
#ifdef HAVE_LIBNUMA
16471648
if (srv_numa_interleave) {
1649+
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
1650+
16481651
ib_logf(IB_LOG_LEVEL_INFO,
16491652
"Setting NUMA memory policy to MPOL_INTERLEAVE");
16501653
if (set_mempolicy(MPOL_INTERLEAVE,
1651-
numa_all_nodes_ptr->maskp,
1652-
numa_all_nodes_ptr->size) != 0) {
1654+
numa_mems_allowed->maskp,
1655+
numa_mems_allowed->size) != 0) {
16531656
ib_logf(IB_LOG_LEVEL_WARN,
16541657
"Failed to set NUMA memory policy to"
16551658
" MPOL_INTERLEAVE (error: %s).",

0 commit comments

Comments
 (0)