Commit 8e8e65ed authored by Daniel Black's avatar Daniel Black

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: default avatarDaniel Black <daniel.black@au.ibm.com>
parent 8b59eab7
...@@ -1157,10 +1157,11 @@ buf_chunk_init( ...@@ -1157,10 +1157,11 @@ buf_chunk_init(
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
int st = mbind(chunk->mem, chunk->mem_size, int st = mbind(chunk->mem, chunk->mem_size,
MPOL_INTERLEAVE, MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp, numa_mems_allowed->maskp,
numa_all_nodes_ptr->size, numa_mems_allowed->size,
MPOL_MF_MOVE); MPOL_MF_MOVE);
if (st != 0) { if (st != 0) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
...@@ -1551,11 +1552,13 @@ buf_pool_init( ...@@ -1551,11 +1552,13 @@ buf_pool_init(
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
ib_logf(IB_LOG_LEVEL_INFO, ib_logf(IB_LOG_LEVEL_INFO,
"Setting NUMA memory policy to MPOL_INTERLEAVE"); "Setting NUMA memory policy to MPOL_INTERLEAVE");
if (set_mempolicy(MPOL_INTERLEAVE, if (set_mempolicy(MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp, numa_mems_allowed->maskp,
numa_all_nodes_ptr->size) != 0) { numa_mems_allowed->size) != 0) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy to" "Failed to set NUMA memory policy to"
" MPOL_INTERLEAVE (error: %s).", " MPOL_INTERLEAVE (error: %s).",
......
...@@ -1235,10 +1235,11 @@ buf_chunk_init( ...@@ -1235,10 +1235,11 @@ buf_chunk_init(
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
int st = mbind(chunk->mem, chunk->mem_size, int st = mbind(chunk->mem, chunk->mem_size,
MPOL_INTERLEAVE, MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp, numa_mems_allowed->maskp,
numa_all_nodes_ptr->size, numa_mems_allowed->size,
MPOL_MF_MOVE); MPOL_MF_MOVE);
if (st != 0) { if (st != 0) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
...@@ -1645,11 +1646,13 @@ buf_pool_init( ...@@ -1645,11 +1646,13 @@ buf_pool_init(
#ifdef HAVE_LIBNUMA #ifdef HAVE_LIBNUMA
if (srv_numa_interleave) { if (srv_numa_interleave) {
struct bitmask *numa_mems_allowed = numa_get_mems_allowed();
ib_logf(IB_LOG_LEVEL_INFO, ib_logf(IB_LOG_LEVEL_INFO,
"Setting NUMA memory policy to MPOL_INTERLEAVE"); "Setting NUMA memory policy to MPOL_INTERLEAVE");
if (set_mempolicy(MPOL_INTERLEAVE, if (set_mempolicy(MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp, numa_mems_allowed->maskp,
numa_all_nodes_ptr->size) != 0) { numa_mems_allowed->size) != 0) {
ib_logf(IB_LOG_LEVEL_WARN, ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy to" "Failed to set NUMA memory policy to"
" MPOL_INTERLEAVE (error: %s).", " MPOL_INTERLEAVE (error: %s).",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment