Skip to content

fix(runtime): restore hot TLS for arena right-sizing - #9736

Closed
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/9709-arena-right-sizing-followup
Closed

fix(runtime): restore hot TLS for arena right-sizing#9736
proggeramlug wants to merge 2 commits into
PerryTS:mainfrom
proggeramlug:fix/9709-arena-right-sizing-followup

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #9731, which landed through merge train #9735. The train was assembled before the final two reviewed branch commits, so it retained a raw thread_local! declaration and mislabeled decimal byte measurements as MiB.

  • route arena right-sizing state through the runtime's hot-TLS cache
  • label the reported decimal workload measurements as MB
  • keep the landed right-sizing policy and behavior unchanged

Closes #9709.

Validation

  • cargo fmt --all -- --check
  • cargo check -p perry-runtime
  • cargo test -p perry-runtime --lib gc::tests::arena_right_size -- --test-threads=1 (5 passed)
  • cargo test -p perry-runtime --lib gc::tests::idle_reclaim -- --test-threads=1 (12 passed)
  • python3 scripts/check_thread_locals.py --self-test
  • policy checker before/after: gc/arena_right_size.rs is reported on landed main and absent with this patch; remaining reports are pre-existing files on main
  • the underlying branch passed 3,104 runtime unit tests, focused arena/idle-reclaim tests, clippy, and all 62 applicable static lint gates before merge-train landing

Release checklist

  • no version bump
  • no Cargo.toml, Cargo.lock, CLAUDE.md, or CHANGELOG.md change

Summary by CodeRabbit

  • Performance
    • Improved memory management for idle workloads by allowing arenas to reclaim excess capacity after sustained low utilization.
    • Right-sizing is bounded and remains paused until usage increases significantly, helping avoid repeated resizing.
    • Updated workload measurements to use MB instead of MiB for clearer capacity reporting.

@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 1e132fea-9fe6-47b7-8dbd-fdee41a3681d

📥 Commits

Reviewing files that changed from the base of the PR and between df36a5e and ec622b2.

📒 Files selected for processing (2)
  • changelog.d/9731-arena-right-sizing.md
  • crates/perry-runtime/src/gc/arena_right_size.rs

Included review availability: Your plan provides up to 8 included reviews per hour; 5 remain after this review.


📝 Walkthrough

Walkthrough

The change switches arena right-size state declarations to the runtime thread-local macro and updates the changelog with MB-based measurements and revised capacity and RSS results.

Changes

Arena right-sizing

Layer / File(s) Summary
Runtime wiring and measured results
crates/perry-runtime/src/gc/arena_right_size.rs, changelog.d/9731-arena-right-sizing.md
The STATE and TEST_USAGE declarations now use crate::perry_thread_local!. The changelog reports updated MB-based workload measurements, arena capacity, and RSS values.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to ec622

This follow-up routes arena right-sizing state through the runtime TLS mechanism and corrects measurement labels to MB. No merge-readiness risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: restoring hot TLS for arena right-sizing.
Description check ✅ Passed The description provides the change summary, related issue, validation commands, release constraints, and checklist information. It uses equivalent headings instead of the exact template headings, but…
Linked Issues check ✅ Passed The PR preserves the arena right-sizing behavior requested by #9709 and applies the follow-up fixes for runtime hot TLS and accurate MB measurement labels. The provided validation confirms focused tes…
Out of Scope Changes check ✅ Passed The changes are limited to arena right-sizing documentation, runtime hot-TLS declaration, and measurement-unit labeling. No unrelated code or repository metadata changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@proggeramlug

Copy link
Copy Markdown
Contributor Author

Landed via merge train #9737, together with three other commits my earlier trains missed the same way (#9704's and #9733's changelog fragments, and #9720's follow-up gap test). Thanks for catching this — the stale-head pick was my error.

@proggeramlug
proggeramlug deleted the fix/9709-arena-right-sizing-followup branch September 4, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GC arena holds 98 MB capacity for 35.7 MB live at cc idle and never shrinks — 62 MB of slack no knob can reach

1 participant