probe: ROOT CAUSE — multi-BRANCH anomaly is ext4 writeback throttle (#146)#151
Merged
Conversation
Round 5 of #146. Two complementary findings: 1. perf with explicit hybrid sampling (-e cpu_core/cycles/P -e cpu_atom/cycles/P) — fixes the Alder Lake E-core blindness from round 4. Got 13 FC samples in a 20s window with 4 slow BRANCHes, 46% of which are in ext4 kernel paths: io_schedule ← wbt_wait ← submit_bio ← ext4_bio_write_folio ← ext4_do_writepages down_write ← ext4_da_map_blocks ← ext4_da_write_begin ← vfs_write crc32c_x86_3way ← ext4_block_bitmap_csum_set ← ext4_mb_mark_diskspace_used ← ext4_mb_new_blocks = ext4 delayed allocation + writeback throttle (wbt) + multi-block allocator + block-bitmap checksumming. 2. tmpfs control — second daemon with --snapshot-root /dev/shm/... Ran 10 consecutive diff BRANCHes: BRANCH 1 (cold): pause_ms=728 BRANCH 2-10: pause_ms 111-259, flat No slow regime. Anomaly is 100% filesystem-layer. Synthesis of all 5 probe rounds: Pass 1 strace -c → user-space CPU (wrong) Pass 2 bpftrace → 94% off-CPU + futex (side obs) Pass 3 futex args → passive waiters (confirmed) Pass 4 perf -a -g → kernel sleep dominates (right direction, blind) Pass 5 perf hybrid + tmpfs → ext4 wbt + mballoc (ROOT CAUSE) Fix path is now clear and small: 1. fallocate memory.bin to full size before FC writes (~30 LOC Rust) 2. O_DIRECT in FC's snapshot writer (upstream FC PR) 3. io_uring (Phase 2 original case, now justified) 4. memfd-backed memory.bin (v0.4) Recommended first step: fallocate. If pause stays flat → ship as forkd v0.3.4 + close #146. Ships: - bench/pause-window/probe-perf-hybrid.sh - PROBE-multi-branch-anomaly.md "ROOT CAUSE FOUND" section - probe-offcpu.sh referenced (already shipped in #150) Refs #146. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WaylandYang
added a commit
that referenced
this pull request
May 23, 2026
…balloc (#152) 5 rounds of probe (#128, #140, #143, #150, #151) traced the multi-BRANCH pause_ms anomaly to ext4 delayed allocation + writeback throttle + multi-block allocator + block-bitmap CRC compounding per BRANCH. tmpfs control confirmed: anomaly is 100% in the fs layer. Fix: posix_fallocate the destination memory.bin to source full size right after we create snap_dir, before either the diff-mode background copy OR FC's snapshot/create write. ext4 reserves the extents up-front; subsequent writes don't run mballoc or update block bitmap. Best-effort — on tmpfs / unsupported FS the syscall returns ENOSYS, we log at WARN and continue (no behavior change). On ext4 (the actual problem case), this should flatten pause_ms across the BRANCH chain. Adds libc 0.2 as a cfg(unix) dep for posix_fallocate. Refs #146. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
9 tasks
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.
Summary
Round 5 of #146. Two findings together identify the root cause.
(a) Hybrid CPU sampling finds ext4 in FC's stacks
Re-ran perf with explicit hybrid event sampling (`-e cpu_core/cycles/P -e cpu_atom/cycles/P`) — fixes the Alder Lake E-core blindness from round 4 (#150). 13 FC samples in a 20 s window with 4 slow BRANCHes:
ext4 stacks include:
= ext4 delayed allocation + writeback throttle (`wbt_wait`) + multi-block allocator + block-bitmap checksumming.
(b) tmpfs control: anomaly vanishes
Second daemon, `--snapshot-root /dev/shm/forkd-snapshots`, same 10-BRANCH sweep:
Pause stays in the 110-260 ms band for all 10 BRANCHes on tmpfs. No slow regime. 100 % of the anomaly is in the fs layer.
Five-round synthesis
Fix path
`#118`'s original Phase 2/3 scope can finally be re-evaluated against real data. Options in order of leverage:
Recommended first step: fallocate. If pause stays flat → ship as forkd v0.3.4 patch + close #146.
Files
Closes investigation phase of #146.
🤖 Generated with Claude Code