Guard the write summary against partially published journal batches #528
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/readmet3xt-lab--foxhound!528
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-528"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@tavochivix on GitHub · 2026-12-03 02:16 UTC · original
tavochivix:codex/pr472-journal-publication→main· +183 −4 · 2 files · 4 commits · openThis builds on @GValdezN's write-summary optimization in #472. The branch keeps the original commit (
3e28da6) and targetsmainso maintainers can review the combined change or take the follow-up commits onto #472. Compare only the follow-up changes.How an alias can be reported clean
landed_besidetakes the journal's exclusive lock and records the affected addresses in one batch. Before it updates the alias's summary bucket, the lock-free reader can still see the old bucket value.Updating the bucket earlier inside each individual
Journal::notewould still leave a gap between notes for different aliases. The unit that needs to be observed consistently is the entire writer transaction. The existing order in which a landing writes the bytes and then records them is preserved.What changes
47ee1bfbrackets every mutation throughjournal_mutwith an odd/even sequence. The reader samples the sequence around the publication and bucket checks. It accepts a clean result only if both samples match and are even. Otherwise the caller uses the existing locked path. Writers hold the exclusive lock through both sequence updates. If a writer unwinds, the fast path stays disabled.430c86cremoves the fullcopied.pagesminimum scan that #472 added after an exact hit on shadows larger than 64 pages. A one-page query could repeatedly scan the entire shadow while a different, older page kept the minimum unchanged. The existing conservative lower bound remains valid.8b83336strengthens the active-writer regression test. A clean published alias is the positive control. The same alias must decline the fast path while the writer is active, even with a threshold high enough for every bucket to pass. A second test covers a writer that starts and finishes during a scan, leaving both sequence samples even.Reproducing the regression on Windows
From the PR checkout, run the focused tests against generated memory:
For the before/after comparison, copy just the first test function into the same
watch::testsmodule at #472's head (3e28da6) and run the first command again. On Windows I verified that this exact test fails on3e28da6at the assertion with the writer held and passes on the submitted head8b83336. In a separate two-thread local test, pausing publication during an actual alias landing produced a false clean answer in 50/50 trials on #472 and 0/50 on the corrected build.At the submitted head, local Windows checks passed:
cargo xtask policycargo clippy --workspace --all-targets --locked -- -D warningscargo clippy --workspace --all-targets --all-features --locked -- -D warningscargo test --workspace --locked— 1,360 passed, 50 ignored, including 622 passed invictory-gpu.Measurements on a Ryzen 5 5600X and RTX 5070 Ti
A synthetic narrow-check benchmark used a large shadow with mixed write epochs. The requested page was already up to date, while an older page kept the whole-shadow minimum below it. At 16,384 tracked pages, the median cost of that one-page check was 8.77 µs on #472 and 0.020 µs with the fix. This measures the check in isolation.
Six release runs used the same automatic 3D camera sequence, two per build, in forward and reverse order. Each started with a fresh copy of the same save and warmed FoxHound cache. The driver cache was shared. Settings were Series X, 4K, frame generation off, no title profile, and default journal batching. The host was Windows 11, NVIDIA driver 610.88, RTX 5070 Ti 16 GB, Ryzen 5 5600X. We sampled a 60-second window starting eight seconds after the first interval with at least 30 blocks landed beside guards per frame. Only complete frame-time log intervals were included.
7dbcdcb3e28da6430c86cThe final commit changes tests only. In the last 30 seconds, pooled FPS was 25.34, 25.82 and 25.57, respectively. Run-to-run variation and mixed frame-time results leave the overall performance effect inconclusive.
In a separate instrumented run, 186 of 109,067 summary queries started during a writer transaction, and two more rejected a possible clean result because the sequence changed during the scan. This measures how often the guard intervened. The test did not identify a specific visual artifact.
@tillo88 on GitHub · 2026-12-04 00:47 UTC · original
Replay-bench measurement on v0.8.3.5: no measurable difference
Measured: PR head
8b83336merged onto release v0.8.3.5 (5e44415), 2 measured runs (after a warm-up run that is not counted), against 5 runs of v0.8.3.5 without the PR (fps range 36.45-37.23), same route (~6.5 min).Mean fps: release 36.76, PR 36.89 (+0.4%): no measurable difference in frame rate. CPU prep, median and p95 frame times are within the release's run-to-run spread; run 1 had the highest p99 of all seven runs (48.67 ms) and the fewest frames over 100 ms (10), run 2 is inside the release's range on both. The bench only shows the cost side of this change; it cannot tell whether partially published journal batches happen on this route.
Crashes: none in the PR runs and none in the release runs (no host GPU failure, no device lost).
Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB, Windows 11; default
play-foxhound.ps1settings (Series X profile, 1440p, DLSS balanced, no frame generation), fullscreen, no frame cap.Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.