mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #742] [CLOSED] xmem: coalesce contiguous runs in XMemMapPhysicalPages #780
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#780
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/742
Author: @madhyn
Created: 11/24/2026
Status: ❌ Closed
Base:
main← Head:perf/xmem-coalesce-map-physical-pages📝 Commits (2)
6ed318fxmem: coalesce contiguous runs in XMemMapPhysicalPagesf6cfa2fxmem: add range-aware unmap_range to avoid O(N^2) bulk unmap📊 Changes
2 files changed (+163 additions, -23 deletions)
View changed files
📝
runtime/shims/xmem.cpp(+128 -23)📝
runtime/test/xmem_test.cpp(+35 -0)📄 Description
What and why
During retail startup (1.0.2.1), after
CopyDescriptorsSimple, the title callsXMemMapPhysicalPageswith 99,776 contiguous pages (6,236.0 MiB) in a single call. Mapping them one 64 KiB page at a time issues ~100k separateVirtualFree(MEM_PRESERVE_PLACEHOLDER)+MapViewOfFile3calls, which under Wine 11.22 takes longer than 30 seconds and triggers the title's internal 30 s watchdog assert (0x142215c35).This change coalesces contiguous runs of pages from the same
Sectionand consecutive offsets into a singleisolate_placeholder+MapViewOfFile3call, while preserving per-page unmap/remap semantics:MappedPagerecordsview_base,view_pages, andview_protect.unmap_pagesplits a multi-page view when a middle page is unmapped or overwritten, re-mapping the surviving prefix and suffix runs while keeping their backing data intact.map_view_runfails (e.g. pre-split placeholders),XMemMapPhysicalPagesfalls back to mapping that run page-by-page.Testing
test_coalesced_run_partial_unmapinruntime/test/xmem_test.cpp(maps 4 contiguous pages, unmaps a middle page, verifies prefix/suffix data survival, remaps the middle page back, unmaps and frees).ctest -R xmemunder Wine 11.22 (Arch Linux):d3d12_xmem_placed: passed.xmem: 223/228 checks passed, including all 11 checks oftest_coalesced_run_partial_unmap(the 5 existing failures are Wine 11.22VirtualQuery/PAGE_READONLY/ commit-charge checks that also fail onmain).gta6rt.sh --run(with #385 + #445 stack): the 99,776-page (6,236 MiB)XMemMapPhysicalPagescall dropped from >30,000 ms (watchdog hang) to 14 ms, advancing boot through device slot 74,dstorage(CreateStatusArray,CreateQueue1, CPU zlib inflate), and reaching device slot 108.AI-assisted: yes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.