Runner: count work in cpu.idle cgroups as idle for routing and overbooking #21
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.43) × (1 − Review Confidence (0.43)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.43 · 366 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.353
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #21"
general
weight: 0.35
coderabbitai[bot]
A miner running beside a runner (XMRig at
CPUSchedulingPolicy=idle) keeps every core at 100% in/proc/stat, so the runner reportedcpu_idle≈ 0. Clients then routed jobs to the weakest idle runner instead of the 16-core ones, and overbooked jobs waited for idle cores that never appeared.The sampler now finds processes whose cgroup, or a parent, has
cpu.idleset (systemd'sCPUWeight=idle), charges each of their threads' tick deltas to the CPU it last ran on, and subtracts that from the pool's busy time that feedscpu_idleand overbooking admission. Acpu.idlecgroup only gets cores nothing else wants. Per-threadSCHED_IDLEalone is deliberately not counted: it yields only within its own cgroup, so a miner insystem.slicewould still take up to about half a contended core fromoffload.slice. Per-CPU busy on the dashboard and the host CPU graph keep the real figure. The README says how to mark a miner's unit.Done lines
1. CPU time of threads in a
cpu.idlecgroup on a runner's offered CPUs no longer counts as busy in its reportedcpu_idle.2. Overbooking admission therefore treats cores held only by such work as idle.
3. Other work, including per-thread
SCHED_IDLEoutside an idle cgroup, still counts as busy.4. The dashboard's per-CPU busy is unchanged.
Budget: ≤60 non-test lines, ≤2 code files, no new options. Actual: about 60 non-test lines in
internal/runner/metrics.go, a test, one sentence each indocs/design.mdandREADME.md.Touch every side: runner only; no API or protocol change (the existing
cpu_idlefield becomes truthful), jobs and sessions alike, all runtimes./proc/<pid>/{cgroup,task/*/stat}andcpu.idleare world-readable, so a user-level runner sees a root miner.Review
SCHED_IDLEdoesn't yield across cgroups, so the first version would overbook onto contended cores; P2, a per-thread policy behind a normal main thread was missed. Both fixed by keying on cgroupcpu.idle(second commit). P3s noted: ticks charged to the CPU a thread last ran on, tid reuse, first interval of a new thread lost; all are bounded by the per-CPU clamp or conservative.Testing
go vet ./...andgo test ./...pass (viaoffload run).TestReadIdleClassbuilds a fake/procand cgroup tree: a process in a child of an idle slice (its owncpu.idle0, the parent's 1) with threads on CPUs 0 and 3 and a command name holding spaces and parentheses, plus a process in a normal slice; it checks the per-CPU deltas and that the normal one is ignored.statfield offsets against a live XMRig thread on vps.CPUWeight=idleon the miners, runoffload host upgrade, and checkcpu_idleon vps and vps-zeno.🤖 Generated with Claude Code (Claude Opus 5.5)