PS-10595 [trunk]: Add innodb_large_page_populate to control huge page pre-population#6055
Open
polchawa-percona wants to merge 1 commit into
Open
Conversation
248b8db to
6e5e3b0
Compare
… pre-population https://perconadev.atlassian.net/browse/PS-10595 This patch is a contribution from Alexey Bychko <abychko@gmail.com>. Introduce a new InnoDB boolean system variable innodb_large_page_populate (Linux only) that controls whether huge pages and page-aligned allocations used by the buffer pool and the page allocator are pre-populated at allocation time. When OFF (default), large_page_aligned_alloc() and page_aligned_alloc() skip MAP_POPULATE and the explicit prefault step by masking the caller's populate request with the global flag. This reduces startup time and NUMA-related overhead on large systems with huge pages. When ON, the previous behavior (honor the caller's populate request) is preserved. The backing global is named srv_large_page_populate, following the srv_ naming convention used by other InnoDB globals. On non-Linux platforms the flag is a compile-time constant true, so behavior there is unchanged. Buffer pool memory is only reserved at buf_pool_init() time; actual physical allocation happens on first page fault. Huge pages are never migrated by the kernel's NUMA balancer, and the NUMA interleave memory policy is only a hint honored at fault time: if a node is briefly out of free memory when a page is first touched, the page lands on a different node and stays there permanently, skewing the buffer pool's NUMA placement for the life of the server. To guard against this, a startup warning is emitted when innodb_numa_interleave and large_pages are both enabled while innodb_large_page_populate is OFF, suggesting to drop the page cache before starting mysqld and to enable innodb_large_page_populate in that configuration so pages are faulted in immediately under the interleave policy.
6e5e3b0 to
e6a1dd6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://perconadev.atlassian.net/browse/PS-10595
This patch is a contribution from Alexey Bychko abychko@gmail.com.
Introduce a new InnoDB boolean system variable
innodb_large_page_populate(Linux only) that controls whether huge pages and page-aligned allocations
used by the buffer pool and the page allocator are pre-populated at
allocation time.
When OFF (default),
large_page_aligned_alloc()andpage_aligned_alloc()skip
MAP_POPULATEand the explicit prefault step by masking the caller'spopulate request with the global flag. This reduces startup time and
NUMA-related overhead on large systems with huge pages. When ON, the
previous behavior (honor the caller's populate request) is preserved.
The backing global is named
srv_large_page_populate, following thesrv_naming convention used by other InnoDB globals. On non-Linux platforms the
flag is a compile-time constant
true, so behavior there is unchanged.Buffer pool memory is only reserved at
buf_pool_init()time; actualphysical allocation happens on first page fault. Huge pages are never
migrated by the kernel's NUMA balancer, and the NUMA interleave memory
policy is only a hint honored at fault time: if a node is briefly out of
free memory when a page is first touched, the page lands on a different
node and stays there permanently, skewing the buffer pool's NUMA placement
for the life of the server. To guard against this, a startup warning is
emitted when
innodb_numa_interleaveandlarge_pagesare both enabledwhile
innodb_large_page_populateis OFF, suggesting to drop the pagecache before starting mysqld and to enable
innodb_large_page_populatein that configuration so pages are faulted in immediately under the
interleave policy.