Repository navigation
gc: Perry-owned memory for GC arena blocks (2 MiB OS regions, huge pages by complete units) - #12132
Merged
Merged
Conversation
Linux arena blocks now come straight from mmap in aligned regions, pooled per agent, instead of from the Rust global allocator. mimalloc keeps native allocations only. Other platforms keep std::alloc.
The bump compared against the effective trigger, which is clamped to the nursery cap, so it could lower an armed whole-arena threshold and re-arm a minor on every small parse. Compare with the whole-arena threshold itself.
Linux GC blocks are 2 MiB in 2 MiB-aligned regions. Page size follows how much of a unit is used, not object lifetime: complete 2 MiB units get MADV_HUGEPAGE in every generation, sub-unit extents and rounded tails stay on base pages. The defrag selector decides from the allocation kind stored in the block, not a size threshold.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configuration
📒 Files selected for processing (29)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This was referenced Oct 7, 2026
Merged
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.
Perry now owns the memory under its GC heap on Linux. Arena blocks come straight from the OS in 2 MiB-aligned regions instead of from the Rust global allocator (mimalloc), and page size is chosen by how much of a 2 MiB unit is used, not by object lifetime.
What changes
std::allocand the 1 MiB geometry.MADV_HUGEPAGEon complete 2 MiB units, and sub-unit extents and rounded tails stay on base pages. A nursery is refilled every cycle, so it is dense, and it gets huge pages like mature memory. There is no prefault, no collapse request and no tuning constant.What it removes: GC memory no longer goes through a general allocator that can't know GC lifetimes or density, and the page-size decision is one rule instead of a nursery/mature split.
Measurements
These were measured on c85c2db (before #12103), on qb6 CPUs 56–63 under the shared measurement lock. n=5 interleaved runs, default auto-optimized builds, and every output matches Node. The rebase onto current main only crossed Buffer/stream test files.
Known limits:
Tests
cargo test --release -p perry-runtime -- --test-threads=1: 5206 passed, 0 failed. Plain main fails only the known z8 RSS flake (Expire retired receiver shapes in the class read cache #12111). The build is clean under-D warnings.Open question for review
A diagnostic control (z8 without the isolation guard, at the larger batch count) hit the young-log verifier at
gc/young_log.rs:173:young log for shapes.families+indices does not name …, reached throughscan_shape_table_rekey_mutduring a moving minor. Main at a matched larger count passed that control, so this is not shown to be pre-existing. It does not reproduce with the guard, and the full suite passes. Reviewers who own the shape table: please check whether the larger blocks expose a missing young-log entry there. The backtrace is available on request.