perf(cli): ship mimalloc in the production feature - #1751
Merged
Merged
Conversation
glibc malloc has no setting that fits a daemon indexing on dozens of worker threads. Measured on beta.41 warming 12 projects: two arenas put 60% of daemon CPU into arena locks; unlimited arenas held 14 GB of freed heap out of 18 GB RSS, and because admission trusts measured RSS the graph never activated again after one peak. Under mimalloc on the same host and corpus the lock share fell to noise and RSS followed live data, 8-13 GB between phases with the same peak, so the resident-memory refusal clears on its own. The production feature now selects alloc-mimalloc, which builds on all four release targets.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
Why an allocator change is the root-cause fix, not a mask
Every previous fix (#1570 token clones,
\bDFA, #1594 arena cap) shared one premise: glibc malloc is the allocator and the code should compensate for it. The census on the live daemon showed glibc has no setting that fits this workload:MALLOC_ARENA_MAX=2(the unit's old cap)__pv_queued_spin_lock_slowpathunder__lll_lock_wait_private;statustook 30.6 s waiting on admissionAdmission trusts measured RSS (
resident_memory.rs), so with glibc the resident-memory policy refused graph activation permanently after one warm peak — the "code graph activation was refused by the resident-memory policy" behind 47 tool refusals in the dogfood run.Measured under mimalloc (same host, same 12 projects, same source)
statustool 30.6 s → 0.14 s.refusedtopending/proceeding.Change
production = ["tracedecay/production", "alloc-mimalloc"]. Release builds use--no-default-features --features production, so this is the shipped allocator on all four targets (verified: the release-profile build linksmi_*). Precedence for overlapping features is unchanged (hotpath-alloc > jemalloc > mimalloc). No code change;malloc_trimreclaimer stays a harmless no-op under mimalloc as its comment already states.Not chosen: jemalloc (tikv-jemallocator has no MSVC support; Windows is a release target).