Repository navigation
perf(libkernel): commit Windows direct backing when mapped - #4281
Merged
oneandonlydean merged 1 commit intoOct 12, 2026
Merged
oneandonlydean merged 1 commit into
oneandonlydean merged 1 commit into
Conversation
10 tasks done
9 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
On Windows, creating direct-memory backing charges its entire allocation to the system commit limit even when only a small part is mapped. Lost Soul Aside allocates almost all 13.5 GiB of guest direct memory at startup; the unused backing leaves too little commit headroom for level loading.
Create paging-file sections with
SEC_RESERVE, then commit reserved mapped pages before applying guest protection. Existing committed views retain their contents. Physical contents remain shared between aliases and survive unmap/remap until their backing is released. Linux keeps its current implementation. This follows Microsoft's CreateFileMapping and VirtualAlloc contracts; it changes host allocation lifetime, not guest protection or shader semantics.Checked open PRs for
SEC_RESERVEand direct-memory commitment. #2054 changes singly mapped pages to private write-watched storage to avoid Windows exception-frame corruption; #637 changes write tracking; neither implements this backing reservation. No equivalent fix was found.Tested
Separate checkout based on main
d146ec1b6, Windows 11 x64, WinLibs GCC 15.2, Release, BUILD_TESTING=ON.libc,libkernelandguest_memory_testsbuild.guest_memorypasses in 1.46 s, including new sparse 256 MiB backing checks that map its first and last pages, verify zero initialization, shared alias writes, unchanged distant contents and preservation across unmap/remap. Existing protection, physical reuse, partial release and alias tests remain passing.A separate native probe allocates 2 GiB, maps 16 KiB at offset 1 GiB and verifies alias writes and remapped contents. System commit rose by 2,167,386,112 bytes immediately after allocation on the same-main baseline, versus 4,861,952 bytes with the integration candidate and 13,668,352 bytes with the isolated branch. These global counters include unrelated host activity; the large eager backing charge is absent, not a promise about exact per-page process accounting.
Lost Soul Aside integration testing with existing graphics/audio dependencies and #4271: startup had about 19.2 GiB commit headroom where the prior run had about 6.4 GiB. It reached the title menu and then level loading; near the end of loading about 3 GiB remained. The run subsequently aborted on
buffer descriptor uses an unsupported type. Earlier cold startup still had an Unreal garbage-collection assertion. Gameplay, green flashes, startup crackling and full playability are not claimed fixed. Integration dependencies are excluded from this branch.Committed pages are not decommitted merely by unmapping a view; their contents must survive later remapping. Commitment persists until the physical backing and remaining views are destroyed. Peak gameplay memory, Linux execution, older Windows versions and full CI remain unverified. No game data, logs, snapshots, probes or experimental diagnostics are committed.
Checklist
main; no other open PR implements the same functions