Permalink
Browse files

Bug #21447964 PAGE FRAMES OF INNODB BUFFER POOL NOT USING

MPOL_INTERLEAVE NUMA POLICY

Problem:

The fix for Bug #18871046 SET NUMA MEMPOLICY FOR OPTIMUM MYSQLD
PERFORMANCE attempts to allocate the innodb buffer pool with
MPOL_INTERLEAVE numa memory policy. But it doesn't do it correctly.

The scenario:

1.  Set the memory policy of process to MPOL_INTERLEAVE
2.  Initialize the InnoDB buffer pool.
3.  Set the memory policy of process to MPOL_DEFAULT

In step 2, there are two parts to the InnoDB buffer pool
initialization.  One is the control block (buf_block_t) memory
allocation.  And the other is the actual database page frames.

The control block memory is immediately allocated
and hence the patch works as expected.  But in the case
of the database page frames, which is using mmap(), it is not working
as expected.  The mmap() call only reserves memory and doesn't do
actual allocation.  The actual allocation happens only when it is
first used.  The allocation of pages will follow the memory policy
that is in place during allocation.

Solution:

While initializing the chunks in buf_chunk_init(), use the mbind() call
to specifically set the memory policy for the reserved memory.  This will
ensure that the database page frames use MPOL_INTERLEAVE memory policy.

rb#9619 approved by Sunny.
  • Loading branch information...
gurusami committed Jul 16, 2015
1 parent 9c1d12e commit d2578b57ba7d90a00281ae124a1cd6c83193f62a
Showing with 16 additions and 0 deletions.
  1. +16 −0 storage/innobase/buf/buf0buf.cc
@@ -1116,6 +1116,22 @@ buf_chunk_init(
return(NULL);
}
#ifdef HAVE_LIBNUMA
if (srv_numa_interleave) {
int st = mbind(chunk->mem, chunk->mem_size,
MPOL_INTERLEAVE,
numa_all_nodes_ptr->maskp,
numa_all_nodes_ptr->size,
MPOL_MF_MOVE);
if (st != 0) {
ib_logf(IB_LOG_LEVEL_WARN,
"Failed to set NUMA memory policy of buffer"
" pool page frames to MPOL_INTERLEAVE"
" (error: %s).", strerror(errno));
}
}
#endif // HAVE_LIBNUMA
/* Allocate the block descriptors from
the start of the memory block. */
chunk->blocks = (buf_block_t*) chunk->mem;

0 comments on commit d2578b5

Please sign in to comment.