Skip to content

perf: stop mimalloc asking for transparent huge pages - #1391

Merged
kvlonge merged 1 commit into
mainfrom
fix/mimalloc-no-thp
Nov 9, 2026
Merged

kvlonge merged 1 commit into
mainfrom
fix/mimalloc-no-thp

Conversation

@kvlonge

@kvlonge kvlonge commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Why

The 10,000-model fresh-process compile guard (2.5 GiB peak RSS) fails on main itself, so it can block every pull request. mimalloc madvises its 1 GiB arenas for transparent huge pages, and with THP in madvise mode (the Ubuntu and CI default) each partly used 2 MiB page stays resident in full. At the compile's peak, smaps shows three arenas flagged hg holding about 470 MiB of huge pages.

Changes

Build mimalloc with its no_thp feature (defines MI_NO_THP on Linux only), so its arenas stay on normal pages. The process THP setting and other platforms are unchanged. The budget is unchanged.

Verification

On one orb, release builds made by uv sync --locked --all-groups --all-extras, running CI's exact systemd-run … MemoryMax=4294967296 … make test-e2e-cold-compile-performance SQLBUILD_BENCHMARK_MODELS=10000. Runs alternated main 43bc9f7 and this branch, 3 each, at load 3 to 4.3 on 8 cores.

Run main peak RSS wall this branch peak RSS wall
1 2,674,393,088 19.40 s 2,588,332,032 19.71 s
2 2,678,317,056 19.33 s 2,599,944,192 19.45 s
3 2,676,510,720 20.10 s 2,591,010,816 19.22 s

Median peak RSS is 85.5 MB lower (−3.2%) and 3.5% under the 2,684,354,560 budget. Compile CPU (user+sys) has a median of 49.6 s on this branch against 50.9 s on main. A smaps snapshot of this build shows no huge-page regions. make check-ci passes. DuckShop: not applicable, because this is an allocator build setting with no project shape or data value.

mimalloc madvises its 1 GiB arenas for transparent huge pages, so on
Linux hosts with THP in madvise mode (the Ubuntu default) every partly
used 2 MiB page stayed resident in full. A cold 10,000-model compile
held about 470 MiB of huge pages at its peak. Building mimalloc with
no_thp keeps those arenas on normal pages and lowers that compile's
peak memory by about 85 MB, with unchanged wall and CPU time. Other
platforms are unaffected.
@kvlonge kvlonge added the full-verify Run the full Verify matrix on this pull request label Nov 9, 2026
@kvlonge
kvlonge enabled auto-merge (squash) November 9, 2026 12:54
@kvlonge
kvlonge merged commit eebb756 into main Nov 9, 2026
95 of 118 checks passed
@kvlonge
kvlonge deleted the fix/mimalloc-no-thp branch November 9, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-verify Run the full Verify matrix on this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant