Repository navigation
gc: cap the adaptive tenuring threshold's occupancy rule at 3, keep the survival-rate lock - #14685
Merged
Merged
Conversation
added 8 commits
November 14, 2026 05:17
…NG_SURVIVALS_MAX restores the climb), survival-rate lock unchanged
…default-ceiling tests, docs and changelog
Finishing Touches
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. |
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.
What
The copying minor's promotion age S has two rules in
crates/perry-runtime/src/gc/tenuring.rs:S = 1 + desired / influx, debounced, held at the floor of 2 until a survivor round has been rated;When few objects survive, the occupancy rule climbed to 4, so every survivor was copied up to three times before it could be promoted. This PR caps the occupancy rule at
OCCUPANCY_MAX_SURVIVALS = 3. The cap sits at the retune callsite, like the floor:compute_target_survivals(..).max(OCCUPANCY_MIN_SURVIVALS).min(occupancy_max_survivals()).These are unchanged:
!= 1test reads it);Controls:
PERRY_GC_TENURING_SURVIVALS_MAX=<n>is a runtime switch, read once, clamped to 2..=4, with one warning when it clamps.=4is main's behaviour.PERRY_GC_TENURING_SURVIVALS=<n>still pins S for every minor and overrides both rules.Tests:
dying_survivor_cohorts_do_not_lockruns at ceilings 2, 3 and 4.Numbers
Measured on qb10 with one release build of 8958b64 (this branch, main merged). Every program was compiled once, and all arms ran on the same binary via
PERRY_GC_TENURING_SURVIVALS_MAX:Method:
instructions:ux3 (taskset 24-31) and peak RSS x5 (/usr/bin/time %M). The program set is from the tenure2 measurement: chess, a medium-lived record benchmark, the GC-ratchet probes and the app-pattern kernels, scaled.Chess search peak RSS, x20 per arm, interleaved:
Reading:
Why the ceiling is 3, not 2. A ceiling of 2 roughly doubles the gain (search -1.56 to -1.60 %). It was rejected for peak RSS:
At S=2, cohorts that a third survivor round would have let die are promoted instead: search promotes 10.65 MB against 10.49 MB.
chess perft, evaluate and legal do not gain, at either ceiling. On those workloads S rises above 2 only on the last minors, which copy almost nothing; copied bytes are equal across arms in a diagnostic build. The
PERRY_GC_TENURING_SURVIVALS=2pin did gain -0.3..-1.4 % there, but that came from switching off the startup parent probe (one copying minor, about 127 KB more copied on perft), not from the ladder. This PR does not change the probe.Relation to #9949
#9949 (perf/tenuring-evidence-lock, open, not touched here) changes the survival-rate lock's latch: a startup window, a K=3 streak, and a sweep seed gated by startup.
retune_after_scavenge's lock block..min(occupancy_max_survivals()).retune_after_scavengeand needs a main merge either way.Recorded, not fixed
The default survival-rate lock misfires on medium-lived records. medium2 W=5k/10k latch S=1, then the cohort dies in old-gen: 3 fulls and about 70..96 MB peak, against 33..57 MB at a pinned S=2 (-12 % instructions). This PR leaves that as it is (rows W=5k/10k). It is a lock question, and #9949's evidence window is the place for it.
Tests
The final head is 9d0ee47 (main merged).
cargo test -p perry-runtime --lib --release -- tenuring copying promot cohort nursery: 376 passed, 0 failed, 2 ignored.PERRY_GC_SCHEDULE_SEED=7.MAX=4, at seed 7 (default rate and rate 1), plus the default arm withPERRY_GC_VERIFY_EVACUATION=1at rate 1.cargo check -p perry-runtime --lib --tests(Mac);scripts/check_gc_env_knobs.pyOK.scripts/check_gc_doc_claims.py: the only problem is one that is already on main (memory-model.mdINT32_TAG).Not run
Full suites, parity vs node, check-mode corpora (no facts change), S0, IR census, vf, tssrc, Supabase, the three.js skin bench, wall time, callgrind.