Repository navigation
fix(mir-fork): per-child private-memory budget and fork-time admission - #10711
Merged
Merged
Conversation
p4-cli-f24 (FORK=5, batch 200, 100G cap) lost a child to the memcg OOM killer at 52.5G anon-rss: the batch bounds claims, not bytes, and LPT hands round 0 the heaviest modules. - SIMPLE_MIR_FORK_CHILD_KB (default 12000000 KiB, 0 = off): a forked child probes /proc/self/smaps_rollup Private_Dirty+Private_Clean after its claim count grows; over budget (only after >=1 claim) it latches its cap, codegens/publishes what it holds and finishes like a full batch. The root's next-batch rule now keys on "batched" (batch>0 or budget on). - Admission: the root forks min(requested, max(1, headroom/budget)), headroom = tightest cgroup v2 memory.max-memory.current, bounded by MemAvailable (direct procfs reads, no subprocess before fork). - Admit SIMPLE_MIR_FORK_BATCH / SIMPLE_MIR_FORK_CHILD_KB next to SIMPLE_MIR_FORK_WORKERS in the three worker env lists. Specs UNEXECUTED: no full-CLI simple binary is deployed on this host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
PR #10663's batching did not make fork mode fit the memory cap. In run p4-cli-f24 (2026-11-22, cgroup cap 100G, FORK=5, batch=200) the processes measured coordinator 18G, root 25G, and children 26-29G RSS. About 7 minutes after the round-0 fork, one child reached 52.5G anon-rss and the memcg OOM killer ended the build. Claims are largest-first, so round 0 lowers the heaviest modules concurrently, well before any 200-module batch ends.
SIMPLE_MIR_FORK_BATCHwas also missing from the three worker env allowlists.Fix
SIMPLE_MIR_FORK_CHILD_KBsets a per-child private-memory budget. The default is 12000000 KiB;0turns it off./proc/self/smaps_rollupPrivate_Dirty+Private_Clean before each new claim.min(requested, max(1, headroom/budget))children, where headroom is the tightest cgroup v2memory.max - memory.currenton the chain, capped by MemAvailable. It reads files only: no subprocess or thread runs before the fork. It prints the count it chooses and the inputs. With f24's numbers it admits 4.native_mir_fork_next_batch_v1takes abatchedflag (batch>0 or budget on), so the loop still terminates.SIMPLE_MIR_FORK_BATCHandSIMPLE_MIR_FORK_CHILD_KBare added todriver_admitted_compile,native_build_environment_identity(an exclusion list, next toSIMPLE_MIR_FORK_WORKERS), andworker_hir_profile_v1, along with its spec.Evidence
memory.currentincludes page cache, which makes admission conservative.🤖 Generated with Claude Code
Review evidence recorded in the session handoff.