Skip to content

fix(parallel): size the process budget by the cgroup CPU quota - #338

Merged
piwi3910 merged 1 commit into
mainfrom
fix/cgroup-cpu-budget
Nov 7, 2026
Merged

piwi3910 merged 1 commit into
mainfrom
fix/cgroup-cpu-budget

Conversation

@piwi3910

@piwi3910 piwi3910 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

runtime.NumCPU() counts host cores, not the container's quota, and
go.mod's go 1.23 keeps Go's container-aware GOMAXPROCS off. On the
quadronix CI job pods (256 host cores, cpu.max 16 CPUs) the budget was
256, so the gate started ~350 prettier processes on 16 CPUs; they missed
the 30 s formatter deadline and the Kuvryn nightly failed on files
reported UNCHECKED.

parallel.CPUs() now caps NumCPU by cgroup v2 cpu.max (or v1
cfs_quota/period), rounding a fractional quota up, at least one. The
shared budget and the SAST slot count both use it.

Tests: go test ./... passes; new TestCPUsFromFollowsTheCgroupQuota fails without the fix. procoder check: 0 blocking.

runtime.NumCPU() counts host cores, not the container's quota, and
go.mod's `go 1.23` keeps Go's container-aware GOMAXPROCS off. On the
quadronix CI job pods (256 host cores, cpu.max 16 CPUs) the budget was
256, so the gate started ~350 prettier processes on 16 CPUs; they missed
the 30 s formatter deadline and the Kuvryn nightly failed on files
reported UNCHECKED.

parallel.CPUs() now caps NumCPU by cgroup v2 cpu.max (or v1
cfs_quota/period), rounding a fractional quota up, at least one. The
shared budget and the SAST slot count both use it.
@piwi3910
piwi3910 merged commit f0eb138 into main Nov 7, 2026
6 checks passed
@piwi3910
piwi3910 deleted the fix/cgroup-cpu-budget branch November 7, 2026 18:33
@piwi3910 piwi3910 mentioned this pull request Nov 7, 2026
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.

1 participant