xmem: page remaps skip the kernel calls that change nothing (VICTORY_REMAP_LEAN=1) #1069
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/fxceless--victory-fork!1069
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1069"
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?
@alexis27yt on GitHub · 2026-11-25 18:23 UTC · original
alexis27yt:remap-lean→main· +134 −20 · 1 files · 1 commits · openEach page the title remaps (
map_alias, ~850 a streaming frame per the README) takes four calls on the process's address space: unmap, split the placeholder, map, commit. Two of them change nothing in the common case:With
VICTORY_REMAP_LEAN=1(off by default) the view is mapped first and the placeholder split only if that fails, and section pages committed once are not committed again. One bit a page is kept inside theSection, so it lives and dies with the section and a reused page number starts clear. Two calls a remap instead of four.Measured outside the title on an i5-12400F: a harness that repeats the same four calls (850 one-page remaps a frame over a 256 MiB
SEC_RESERVEsection into one-page placeholders):VirtualProtect4 KiBGetWriteWatch(RESET)of 1 GiBHonest scope: that is ~2-9 ms of a streaming frame, against the 246 ms of remapping the README measures in game. The calls themselves are not where that time goes. Even beside a 1 GiB write-watch asking (~5 ms each), a remap averaged 10-20 µs here, not the ~290 µs per page seen in game. So the rest is waiting on something this harness does not reproduce: the
MAPPINGlock behind in-place readers, or a longer holder of the address space. The frame log'sRemapWaitUsagainstRemapUsfrom a streaming scene would tell which.shortcut:a page the title itself decommits through one of its views would still be noted committed (documented at the switch); no title is known to do that with physical pages.Tests: new
a_section_notes_the_pages_committed_through_it; all 13xmemtests (real mappings) pass with and without the switch on the i5-12400F. Clippy: no new warnings.@tikD1337 on GitHub · 2026-11-25 20:09 UTC · original
Measured the split you asked for, on native Windows 11, RTX 4070 Ti SUPER (driver 621.01), Ryzen 5 7600, Series X profile. The build is a diagnostics build of
origin/maind510ee4with frame-log counters of my own (not in any PR). The 330 s scripted run goes menus → opening cutscene → standing in the prison, with the usual launcher switches.The remap time is not waiting.
RemapWaitUsstays at or under 0.2 ms a frame in all 8 runs, with or without #1063's batching. Readers hold theMAPPINGlock 2–6 ms a frame, nearly all of it texture refresh, never draws.It is the kernel calls. I timed the hold time inside
xmem:VirtualFreesplit or coalesce,MapViewOfFile3, theVirtualAlloccommit,UnmapViewOfFile2;title_memory_remappedandtitle_memory_view, which take the guards' and the views' mutexes.That is about 0.27 ms of kernel time per remap call in game, against your 10–20 µs outside the title. So the time goes to the address-space calls being slow inside the title's process, not to the lock behind in-place readers. I did not test
VICTORY_REMAP_LEAN, and I did not split the kernel time by call.View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.