HLE/dstorage: a queue's unsubmitted requests under its own lock #934
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/934"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by 0xkn0wh3r3 on 2026-11-28T09:24:32Z.
Based directly on
main; independent of #933 (kernel writes without the guards' lock), which goes with it.Why
Every enqueue of the title's (up to 4,095 requests a batch) took the DirectStorage scheduler's single lock (
Lanes), which every worker also takes to start and to finish each read. So the title's thread queued behind the workers for each request it enqueued. Every submit also woke all the workers at once, whatever the batch held.What
Unsubmitted, shared by the queue object and its lane).a_full_queue_submits_itself), or waits for a finish with the queue's lock let go, so the title's submit is not held up.VICTORY_DSTORAGE_QUEUE_LOCAL=0turns it off: every enqueue takes the scheduler's lock and a submit wakes every worker, as before.Before / after
cargo test --release -p victory-hle --lib enqueues_beside_busy_workers -- --ignored --nocapture(added here). Two threads, each with a queue of the title's size (4,159 entries), enqueue batches of 4,095 copies of 4 KiB from memory and a status entry, submit, and wait for the status, while all 24 workers run them. Runs with the switch on and off take turns, 7 of each, 1.5 s each; medians of the runs, on this branch:VICTORY_DSTORAGE_QUEUE_LOCAL=0)The enqueue time was lower in every pair of runs. End-to-end throughput is unchanged: the workers are the limit in this test, so what the change gives back is the title's thread's time.
Correctness
batches_of_many_threads_complete_in_order: four threads, each with a queue of 128 entries, enqueue batches of 100 reads and a status entry and submit, so each batch waits for room the one before leaves. Every status lands only after every read before it (its bytes are all there when it does). Run with the switch on and off.a_full_queue_submits_itself,half_a_queue_waits_for_the_submit,a_status_waits_for_every_earlier_read,statuses_complete_in_order_with_the_first_failure,priorities_share_by_bytes_about_tenfold,staging_bounds_compressed_bytes_in_flight,a_closed_queue_completes_nothing.VICTORY_DSTORAGE_HALF=1, onlyhalf_a_queue_waits_for_the_submitfails, since it asserts the opposite of half-submits.cargo test --workspace --lockedpasses with no failures; clippy with-D warningsreports nothing indstorage.rsin either build (it reports one finding ingameinput.rs, already onmain).Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-28T09:28:31Z.
Review: APPROVED
Tested locally merged onto
main(63b902f).cargo xtask policypassed (294 files ok).cargo test -p victory-hle --lib dstoragepassed (19 passed; 0 failed; 2 ignored, including the newbatches_of_many_threads_complete_in_orderconcurrency test) with 0 compiler warnings.Clean per-queue lock separation reducing contention between enqueueing threads and busy DirectStorage workers. LGTM.
Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
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.