startup-runtime: the DirectStorage destination check costs ~10 ms of kernel time per request (VirtualQuery over large regions) #2684
Labels
No labels
accessibility
awaiting author
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
priority: P0
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/R0Y00--Xbox2Windows#2684
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@lukaslw-lab on GitHub · 2026-11-26 02:00 UTC · original
The DirectStorage stand-in's destination check (
destination_writable,xcrdapi.cpp, added in #1672) walks each destination withVirtualQuery. On the title's multi-gigabyte regions one query scans to the end of the region (the mechanism behind #2610, and the reason #1766 andprobe_readableavoid it), so the check costs about one CPU core during the main executable's first load (#870).Windows 10 22H2, i7-4790K, RTX 3080 Ti, release build of
f4c6998a, warm shader cache, same switches in both runs. Per-thread CPU time of the stand-in's threads from!runaway(cdb, non-invasive) every 20 s, paired with the storage heartbeat:VirtualQuerycalled fromdestination_writable.destination not writable.Fix in #2685: probe the destination one byte per page with a value-preserving write instead of querying it.
This report was prepared with AI assistance (Claude); the runs are mine.
@triggered02 on GitHub · 2026-11-26 03:38 UTC · original
This was fixed by #2685 (
9caa6985startup: probe DirectStorage destinations instead of walking them with VirtualQuery) and the current main (␀8814b4f) shows the shape you described as the remaining fallback only:src/startup_stubs/xcrdapi.cpp:182 destination_writable() now asks
esident_read_write(cursor, end) first and returns after a resident read-write probe; the VirtualQuery loop under it only judges pages that are not resident read-write (not resident, copy-on-write, guard, no access). Your profile � one CPU core for the whole first load, VirtualQuery in every stack sample from destination_writable � is the walk path, which a normal writable destination no longer enters.
So the ~10 ms/request cost in the table (11.9 ? 9.9 ? 12.2 ? 12.2 ms per request across the four windows) is addressed by construction rather than by a benchmark I ran here; I have not independently re-measured the per-request kernel time on your hardware, and I am not claiming the numbers moved by a specific amount. !runaway per-thread kernel time from the same 20 s cadence, with the same switches, would confirm the drop and belongs in this thread if you have it.
Since the issue is yours, could you close it if the re-measurement confirms it, or reopen the walk case if a destination still lands there? I cannot close another author's issue from this account.