fix(queue): a timed run's noise is what its own processes stalled on, not the PC's swapping #2409

Merged
HumanBean merged 1 commit from HumanBean/Longshot:push-pzwzrlmounmm into main 2026-11-23 21:15:41 +00:00
Owner

Summary

Since #2403, every timed run on a 32 GB PC comes out NOISY even when nothing else runs. The game holds about 18 GB it can't swap (its job's scope has MemorySwapMax=0: 11.3 GB anonymous plus 6.9 GB shared memory). The rest of the PC is swapped out at 50–160 MB/s, and the PC-wide memory PSI rises to 2–6 %. Meanwhile the game's own job stalls only 0.05 % on memory, 0.3 % on disk and 0.5 % on CPU, and its frames are clean (Kokiri Forest p99 11.6 ms).

  • The stalls are now the run's own. The queue reads the CPU, memory and disk PSI from the job's own cgroup (cgroup_of, pressure(..., cgroup)), falling back to the PC's where there is none (Windows, or no systemd scope). A sample says which it read (own).
  • The swap rate no longer marks a run NOISY. It is still recorded (swap_mb, swap_mb_s). Swapping that hurts the run shows up as the run's own memory or disk stalls.

Testing

Tested: Linux (CachyOS 7.3), RTX 3090, during a release_bench.py run at 1080p. The game's job scope read 0.05 % memory, 0.23 % disk and 0.06 % CPU "full" stalls, while the whole PC showed 0.7–6.2 % memory stalls and swapped 51–162 MB/s; frame times were clean. The new tests cover the cgroup's PSI files, the own flag, and swapping alone giving no reason; they weren't run on this PC (CI runs them).

Still to test:

  • A timed run beside a memory-heavy job (a test suite): its job's own memory or disk stalls mark it NOISY (by hand)

Measurements

Nothing to measure: dev tooling.

Risks

A run slowed by another process only through the memory bus or the L3, with no stall of its own, is no longer caught by the PSI limits. The other CPUs' use (over 50 % busy) still catches a heavy job beside it.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). (CI)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.

πŸ€– Generated with Claude Code

## Summary Since [#2403](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2403), every timed run on a 32 GB PC comes out NOISY even when nothing else runs. The game holds about 18 GB it can't swap (its job's scope has `MemorySwapMax=0`: 11.3 GB anonymous plus 6.9 GB shared memory). The rest of the PC is swapped out at 50–160 MB/s, and the PC-wide memory PSI rises to 2–6 %. Meanwhile the game's own job stalls only 0.05 % on memory, 0.3 % on disk and 0.5 % on CPU, and its frames are clean (Kokiri Forest p99 11.6 ms). - **The stalls are now the run's own.** The queue reads the CPU, memory and disk PSI from the job's own cgroup (`cgroup_of`, `pressure(..., cgroup)`), falling back to the PC's where there is none (Windows, or no systemd scope). A sample says which it read (`own`). - **The swap rate no longer marks a run NOISY.** It is still recorded (`swap_mb`, `swap_mb_s`). Swapping that hurts the run shows up as the run's own memory or disk stalls. ## Testing **Tested:** Linux (CachyOS 7.3), RTX 3090, during a `release_bench.py` run at 1080p. The game's job scope read 0.05 % memory, 0.23 % disk and 0.06 % CPU "full" stalls, while the whole PC showed 0.7–6.2 % memory stalls and swapped 51–162 MB/s; frame times were clean. The new tests cover the cgroup's PSI files, the `own` flag, and swapping alone giving no reason; they weren't run on this PC (CI runs them). **Still to test:** - A timed run beside a memory-heavy job (a test suite): its job's own memory or disk stalls mark it NOISY (by hand) ## Measurements Nothing to measure: dev tooling. ## Risks A run slowed by another process only through the memory bus or the L3, with no stall of its own, is no longer caught by the PSI limits. The other CPUs' use (over 50 % busy) still catches a heavy job beside it. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). (CI) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. πŸ€– Generated with [Claude Code](https://claude.com/claude-code)
fix(queue): a timed run's noise is what its own processes stalled on, not the PC's swapping
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 21s
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Failing after 26s
CI / Website build and checks (pull_request) Failing after 28s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 31s
CI / Workflow lint (actionlint) (pull_request) Successful in 34s
Third-party parts / As their notes say (pull_request) Successful in 43s
5d3cb433bf
A game holding 18 GB it can't swap (MemorySwapMax=0) pushes the rest of a 32 GB PC into swap at 50-120 MB/s, and the
PC's memory stalls rise with it, while the game's own job stalls 0.05 %: every run on this PC came out NOISY. The CPU,
memory and disk stalls are now the job's cgroup's PSI where it has one, and the swap rate is recorded but judges nothing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean changed title from WIP: fix(queue): a timed run's noise is what its own processes stalled on, not the PC's swapping to fix(queue): a timed run's noise is what its own processes stalled on, not the PC's swapping 2026-11-23 21:15:30 +00:00
HumanBean deleted branch push-pzwzrlmounmm 2026-11-23 21:15:42 +00:00
Member

Possibly related, for context:

  • PR #2187 WIP: fix(dev): a timed run's noise names the queue's jobs that ran beside it β€” Overlapping timed-run noise tracking in the queue
  • PR #2257 WIP: fix(queue): a light suite waits for a timed run or game β€” Queue scheduling work touches the same code and tests
Possibly related, for context: - PR #2187 WIP: fix(dev): a timed run's noise names the queue's jobs that ran beside it β€” Overlapping timed-run noise tracking in the queue - PR #2257 WIP: fix(queue): a light suite waits for a timed run or game β€” Queue scheduling work touches the same code and tests
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2409
No description provided.