DirectStorage: keep raw reads running while staging drains #1456
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1457"
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?
Imported from Marvisak/VIctory. Originally posted by Luizbc2 on 2026-11-24T18:09:27Z.
Summary
If the scheduler picks a read that cannot fit in the remaining staging space, it currently stops dispatching reads from every queue. A raw read at the front of a different queue needs zero staging bytes and can run while the buffered work drains.
Allow that read to run. Keep the existing weighted queue order among eligible reads and continue reserving staging space for the blocked request. Smaller buffered requests therefore cannot indefinitely postpone a larger one.
Reproduction and testing
cargo test --workspace --lib --locked --offline modules::dstorage::testsThe new synthetic test sets a 100-byte staging limit, holds 60 bytes in flight, and queues a blocked 120-byte read, a raw read, and a small buffered read in different queues. On
ffe310ethe scheduler returns no work. With the patch it starts the raw read, waits for staging to drain, then starts the 120-byte read. All 14 DirectStorage tests passed on Windows.AI-assisted with Codex.
Imported from Marvisak/VIctory. Originally posted by acetonahard-code on 2026-11-24T21:05:58Z.
Heads-up: #1187 (opened about two hours earlier) changes the same scheduler block in
dstorage.rs. A read that needs no staging keeps going when the next read can't fit the staging space. The two conflict, so only one can land as-is.Tested on Windows 11 with the repo toolchain, merged into current
main(ffe310e):cargo test -p victory-hlemainmain+ this PRcargo clippy --all-targets -- -D warnings, with and without--all-features: clean.cargo fmt --checkwould rewrap one block this PR adds (dstorage.rs).mainisn't rustfmt-clean either, so take it or leave it.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:28:12Z.
Automated triage for the maintainers.
Merge candidate.
Lanes::startincrates/victory-hle/src/modules/dstorage.rsnow starts a queue's raw (zero-staging) read when the next read in order must wait for staging space. It still holds staging back for the blocked request, so smaller buffered reads cannot overtake it. The candidate tuple (class clock, class, lane clock, seq, id) gives the same order asmain's two-step choice, and the new test covers the blocked/raw/drain sequence. The overlapping #1187 is closed. One small point: a raw read from another class setsnowfrom that class's clock, which can later step back; #1187 usedmaxfor this, which may be worth doing here too. CI has not run on this head; a tester reports the HLE tests and clippy pass.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T00:51:58Z.
Code review (concurrency & ordering audit) and Windows 11 verification at head
ff3b10e753a3merged cleanly ontomain(63bcca43c6a0):crates/victory-hle/src/modules/dstorage.rs:513-557):selected.5 != 0) andself.staged > 0 && self.staged + selected.5 > self.staging, falling back tonext_read(true)still inspects only each queue'slane.reads.front(). Raw reads in the same queue never overtake a blocked staged read ahead of them, soLane::flushseqordering and error propagation stay intact.self.starved = trueis set before the raw fallback (line 536), so when the in-flight staged read completes,work()(std::mem::take(&mut lanes.starved)) wakes waiting workers vianotify_all()with no lost-wakeup or deadlock window.self.staged > 0(so oversized single requests still launch oncestaged == 0), and blocked staged queues do not advance their virtual clock.cargo xtask policy:191 files ok;cargo clippy --locked -p victory-hle --tests -- -D warnings: 0 warningscargo test --locked -p victory-hle -- dstorage: 17/17 passed (includingraw_reads_from_other_queues_can_run_while_staging_drains).LGTM.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.