Skip to content

MDEV-38918 Make large pages an explicit per-caller opt-in - #5609

Open
vaintroub wants to merge 1 commit into
10.11from
10.11-MDEV-38918
Open

MDEV-38918 Make large pages an explicit per-caller opt-in#5609
vaintroub wants to merge 1 commit into
10.11from
10.11-MDEV-38918

Conversation

@vaintroub

Copy link
Copy Markdown
Member

Summary

my_large_malloc() attempted large pages whenever --large-pages was enabled, silently rounding the size up and reporting it back via an in/out parameter. ut_malloc_dontdump() never passed that adjusted size on to its own callers (the InnoDB redo log buffer and recv_sys_t::tmp_buf), so freeing later used the original, smaller size, causing the reported "faux memory leak".

Only the buffer pool and the MyISAM/Aria key caches are documented to benefit from large pages. Everything else that ended up calling my_large_malloc() only wanted its "do not dump to core" property and picked up large pages as an undocumented side effect; those buffers are also small and sequentially accessed, so they would have gained little from large pages anyway.

  • Add MY_TRY_LARGE_PAGES: my_large_malloc() and my_large_virtual_alloc() now only attempt large pages when a caller passes this flag, instead of always trying whenever the global option is set. Only the buffer pool and the key caches pass it.
  • The redo log buffer, tmp_buf, and row0log.cc's crypt buffers no longer request large pages at all, removing the size-rounding bug for them without touching that code.
  • Fix a broken mtr suppression regex in main.large_pages that would fail the test on Windows.

Test plan

  • main.large_pages passes
  • Manual repro: mariadbd.exe --large-pages with an oversized buffer pool, confirmed graceful fallback and shutdown reports no leak

my_large_malloc() attempted large pages whenever --large-pages was
enabled, silently rounding the size up and reporting it back via an
in/out parameter. ut_malloc_dontdump() never passed that adjusted
size on to its own callers (the InnoDB redo log buffer and
recv_sys_t::tmp_buf), so freeing later used the original, smaller
size, causing the reported "faux memory leak".

Only the buffer pool and the MyISAM/Aria key caches are documented
to benefit from large pages. Everything else that ended up calling
my_large_malloc() only wanted its "do not dump to core" property and
picked up large pages as an undocumented side effect; those buffers
are also small and sequentially accessed, so they would have gained
little from large pages anyway.

Add MY_TRY_LARGE_PAGES: my_large_malloc() and my_large_virtual_alloc()
now only attempt large pages when a caller passes this flag, instead
of always trying whenever the global option is set. Only the buffer
pool and the key caches pass it. The redo log buffer, tmp_buf, and
row0log.cc's crypt buffers no longer request large pages at all,
which removes the size-rounding bug for them without touching that
code.

Also fix a broken mtr suppression regex in main.large_pages that
would fail the test on Windows.
@vaintroub
vaintroub requested a review from dr-m August 27, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant