Skip to content

fix(broker): bound the squatter total by the card's used memory (#103) - #110

Merged
T-Crypt merged 4 commits into
mainfrom
T-Crypt/fix-103
Oct 21, 2026
Merged

T-Crypt merged 4 commits into
mainfrom
T-Crypt/fix-103

Conversation

@T-Crypt

@T-Crypt T-Crypt commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Fixes #103, reported by @azrael-229.

On Windows the PDH Dedicated Usage reading counts a process's committed reservation. The v0.3.2 cap (#82) bounds each process, but the sum could still pass what the driver says the card uses. In the report, dwm.exe read ~11 GB on a 16.3 GB card the driver showed at ~15.5 GB used, so every sized berth run was refused with "at most 0 MiB can be freed".

  • The squatter total used for decisions is now min(sum, card used - baseline - what leases and claims really hold). It feeds admission, the contested-grant figure and the "squatters hold N MiB" reason. Lease and claim bytes are their measured per-process readings, not their needs budgets.
  • An unknown used figure (0) keeps today's plain sum. On Linux the readings are exact, so the bound does not engage in normal operation.
  • Per-squatter entries in status and events keep the raw readings.
  • When the clamp engages or lets go, one INFO line (sum_mib, bound_mib), never per tick.

Tests, with the issue's numbers: a 100 MiB probe is granted (red on main: the acquire never returns), a 2000 MiB request still waits with the bounded figure in its reason, a sum under the used figure is unchanged, and the log fires once per state change.

Proof: build, gofmt, vet, go test ./..., -race on the squatter tests, GOOS=windows build and vet, golangci-lint (0 issues).

On Windows a process's Dedicated Usage reading counts its committed
reservation. The v0.3.2 cap bounds one process, but the sum could still
pass what the driver says the card uses: dwm.exe read 11 GB on a 16 GB
card reported at 15.5 GB used, and every sized berth run was refused.

The squatter total that feeds admission, the contested-grant figure and
the wait reason is now at most the card's used memory minus the
baseline and what leases and claims really hold. An unknown used figure
keeps the plain sum. Per-squatter entries keep their raw readings. The
clamp logs once per change of state.

Fixes #103.
@T-Crypt
T-Crypt merged commit 225da00 into main Oct 21, 2026
2 checks passed
@T-Crypt
T-Crypt deleted the T-Crypt/fix-103 branch October 21, 2026 16:32
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.

windows: after the #82 per-process cap, the squatter SUM still exceeds the card total and blocks all admission (single-GPU)

1 participant