The title's map/unmap calls wait for Windows' large-page worker on the one big section; 2 MiB sections remove the wait #1087
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?
Imported from fxceless/victory-fork. Originally posted by RyanCase94 on 2026-11-25T19:04:34Z.
Following on from
d510ee4("the dips while moving, measured"): a kernel trace says what the title's map and unmap calls wait for, and a small change removes the wait without changing how pages are mapped. Patch below; it applies cleanly tomainatd510ee4.What the calls wait for
Setup: RTX 4070 Ti, Ryzen 7 5800X, Windows 11 26200,
--console series-x, the first minutes of the prologue. Anxperftrace (PROC_THREAD+LOADER+CSWITCH+DISPATCHER, stacks onCSwitchandReadyThread) taken while the title streams, read for 4 seconds:ExfAcquirePushLockExclusiveExunderMiPostInsertVad < MiInsertVad < MiMapViewOfDataSection(1.06 s) and underMiManageSubsectionView < MiDeleteVad < MiUnmapVad(1.00 s). So mostly not the address space lock itself but the section's.ExfReleasePushLockShared < MiTrimSection < MiTrimSharedPage < MiTradePage < MiClaimPhysicalRun < MiFindContiguousPagesEx < MiRebuildLargePage < MiRebuildLargePages < ExpWorkerThread.MiViewMayContainPage < MiTrimSection.So: Windows' large-page rebuild worker trades the section's pages one by one. For each page it looks through the section's views and holds the section meanwhile.
XMemAllocatePhysicalPagesmakes one section per request (the title asks for 6.1 GiB at once) and the title maps it a 64 KiB view at a time, so that one section has views by the hundred thousand: every trade is slow and every trade holds all of the title's physical memory.Ruled out on the way, by measurement: the kernel reads of title memory (
VICTORY_COPY_PLAIN=1changed nothing), write-watch askings (none over 1 ms), and crowding of the title's pinned threads (VICTORY_SPREAD=1with all processors spare changed nothing).The change
Sections of 2 MiB instead of one per request (
VICTORY_SECTION_MB, 0 = as before). A trade then looks through a few dozen views and holds one small section. Mapping is otherwise as it was (still one view per run of consecutive pages of one section, somap_aliasstill maps page by page);Views::sectionsbecomes a map because there are now thousands.Measured
First 90 s after reaching the prison, map/unmap system calls of 1 ms or more:
Not shown
d510ee4measures them on the render thread's way in cutscenes, so it may show more there.Patch
Imported from fxceless/victory-fork. Originally posted by HLVM04 on 2026-11-25T20:34:29Z.
A data point for two of the "not shown" items: Series S mode, and frame times. RTX 5070 Ti, Ryzen 7 9800X3D, Windows 11 build 26200, first gameplay scene, on our own stack (an older fork main plus several open PRs and local changes).
The patch from this issue, applied alone with the default
VICTORY_SECTION_MB=2:So here the gain is mostly in the long frames, which fits the dips you describe. That's one scene and few runs, and I didn't take a kernel trace, so I can't say how many map/unmap calls still block. On top of it, #868's
VICTORY_SKIP_WC_BACK=1gave a median of 71–72 ms with no crash or device loss in 2 runs of 200 s.Edit (2026-11-26):
VICTORY_SKIP_WC_BACK=1turned out not to be free on our stack: the room's lamp light goes missing and rooms render dark (our earlier runs were judged only by the character). The section-patch numbers above were taken without it.Imported from fxceless/victory-fork. Originally posted by Exopus-0x65f7ad0 on 2026-11-25T21:47:59Z.
Confirmed on a third machine, and in the opening cutscene, where it pays the most: RTX 5060 Ti 8 GB, Ryzen 7 8700F, 16 GB RAM, Windows 11, Series S. Tree: fork
maind510ee4plus a stack of fork PRs (#868, #1031, #1063 among them). I applied your patch unchanged, with the defaultVICTORY_SECTION_MB=2.I summed the frame log's
remapping:field over the long frames from the first 3D frame to the first gameplay frame:What remains in the cutscene's long frames is mostly the submit thread's copies (~11 GB over the cutscene) and page faults. No new defect in the picture: faces through the bar and prison shots look as they did before. One run with the patch so far, so the fps figure is a first reading. The remapping drop, though, is far outside the run-to-run noise.
🤖 Generated with Claude Code
Imported from fxceless/victory-fork. Originally posted by KainanP on 2026-11-26T11:23:37Z.
A synthetic reproduction of this stall, which needs no game, with numbers on an i7-14650HX: https://github.com/fxceless/victory-fork/pull/1274 (comment below the PR). 4 GiB of physical pages in one section, remapped page by page while another thread makes and frees memory, had 1,386 remaps of 1 ms or more in 10 s. With 2 MiB sections that drops to 28, and throughput goes from 6,644 to 50,607 remaps/s (median of 5 rounds). The same change is also proposed for upstream (Marvisak/VIctory#3177) and AnyXboxX (LooperSalty/AnyXboxX#352), with credit to you for the idea and the first patch.
AI use: Claude Code (Claude Opus 5.5) wrote the benchmark and this note.
Imported from fxceless/victory-fork. Originally posted by luisaugustz on 2026-11-28T15:38:27Z.
Data point from AMD: RX 9070 XT, Ryzen 7 5800X, 32 GB, Windows 11, Series X 1.0.2.1, gameplay (driving around). Own fork build,
VICTORY_MAP_THREADS=1.Before the fix, xperf agreed with this issue: in a 12 s capture of a slow stretch, 91% of the blocked time in mapping calls was released by the System process's large page rebuild worker. A 12 s capture of a fast stretch had none from it.
Then I cherry-picked a531978d6 from #1274 and set
VICTORY_SECTION_MB=2. One run before and one after, different driving:Median frame time at similar draw counts stayed about the same. No mapping errors.
Also: 8 mapping threads was clearly worse than 1 here before the fix (mean 119 vs 84 ms over six alternating 30 s pairs).
If you use
VICTORY_PORT_CONSTANTS=1: it needs the title's 185 MB heap in one section. Keeping allocations up to 512 MB whole and splitting only larger ones let it open again for me.