Bug #79434 Incorrect NUMA-specific code in buf_chunk_init()
Submitted: 27 Nov 2015 9:32 Modified: 7 Dec 2015 17:45
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7.9 OS:Any
Assigned to: CPU Architecture:Any

[27 Nov 2015 9:32] Alexey Kopytov
Description:
I think the following code in buf_chunk_init() should use
chunk->mem_pfx.m_size instead of mem_size:

---
#ifdef HAVE_LIBNUMA
	if (srv_numa_interleave) {
		int	st = mbind(chunk->mem, mem_size,
				   MPOL_INTERLEAVE,
				   numa_all_nodes_ptr->maskp,
				   numa_all_nodes_ptr->size,
				   MPOL_MF_MOVE);
		if (st != 0) {
			ib::warn() << "Failed to set NUMA memory policy of"
				" buffer pool page frames to MPOL_INTERLEAVE"
				" (error: " << strerror(errno) << ").";
		}
	}
#endif // HAVE_LIBNUMA
---

The large memory allocator may round the requested memory block size to
the OS page size, or the large page size if. As a result, some trailing
pages in the chunk will not be interleaved.

How to repeat:
Inspect the code. Note that the code a few lines down uses chunk->mem_pfx.m_size to get the real chunk size, not mem_size
[1 Dec 2015 15:14] MySQL Verification Team
Although, there is no any proof submitted, this seems to be a valid feature request.

Verified.
[7 Dec 2015 17:45] Daniel Price
Posted by developer:
 
Fixed as of the upcoming 5.7.11, 5.8.0 release, and here's the changelog entry:

In Numa-related code, the size information passed to the mbind() call in
the buf_chunk_init() function was incorrect. 

Thank you for the bug report.