Coalesce separately unmapped pages in XMemMapPhysicalPages #4761

Open
github-bot wants to merge 1 commit from github-bot/gh-4760 into main AGit
Owner

@⁠Saikava on GitHub · 2026-12-01 05:47 UTC · original
Saikava:fix/xmem-contiguous-remap → main · +41 −1 · 1 files · 1 commits · open

What it changes

When two adjacent physical pages are unmapped one at a time, Windows leaves a separate placeholder for each page. Mapping the consecutive pages again in one call asks Windows to replace both placeholders with one section view. The call returns null even though both page IDs and the destination are valid.

If a multi-page run starts at a known placeholder shorter than the run, map_pages now asks the existing one_placeholder helper to join an exact cover before placing the view. The regression test gives each page a distinct byte and checks both remapped pages and a third page that stayed mapped.

How it was tested

Windows 11 x64 build 26300, Rust 1.98.1 MSVC. The test uses synthetic pages and the public XMem calls. No game session or FPS measurement was used.

  • Ran cargo test --locked -p victory-hle --lib modules::xmem::tests::separately_unmapped_pages_can_be_mapped_as_one_run -- --exact with VICTORY_LAZY_VIEWS=0 and =1, with VICTORY_SOFT_VIEWS=0 in both. On 5fabb46e with only the test added, both runs returned null at the two-page remap. On e3c6dbd7, both runs passed and all three bytes matched.
  • RUST_TEST_THREADS=1 cargo test --locked -p victory-hle passed on the patch with 470 unit tests and 2 integration tests passing, and 13 unit tests ignored.
  • With four test threads, the full crate run failed the same existing range-lock test on both the clean base and this change. See #2439.
  • cargo xtask policy --staged passed. cargo clippy --locked -p victory-hle --all-targets -- -D warnings reported the same five findings in victory-gpu on both revisions. Tracked by #4708.

Checked for overlap

  • Searched open and closed issues and PRs for the mapping call, contiguous remaps and placeholder coalescing. Checked the heads of all 173 open PRs touching xmem.rs among the 934 open PRs at the time of review. No matching fix found. Related work includes Wine mappings in #2455, alias-source locking in #4143 and unchanged mapping batches in #4607.
**@⁠Saikava** on GitHub · 2026-12-01 05:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/4760) `Saikava:fix/xmem-contiguous-remap` → `main` · +41 −1 · 1 files · 1 commits · open ## What it changes When two adjacent physical pages are unmapped one at a time, Windows leaves a separate placeholder for each page. Mapping the consecutive pages again in one call asks Windows to replace both placeholders with one section view. The call returns null even though both page IDs and the destination are valid. If a multi-page run starts at a known placeholder shorter than the run, `map_pages` now asks the existing `one_placeholder` helper to join an exact cover before placing the view. The regression test gives each page a distinct byte and checks both remapped pages and a third page that stayed mapped. ## How it was tested Windows 11 x64 build 26300, Rust 1.98.1 MSVC. The test uses synthetic pages and the public XMem calls. No game session or FPS measurement was used. - Ran `cargo test --locked -p victory-hle --lib modules::xmem::tests::separately_unmapped_pages_can_be_mapped_as_one_run -- --exact` with `VICTORY_LAZY_VIEWS=0` and `=1`, with `VICTORY_SOFT_VIEWS=0` in both. On `5fabb46e` with only the test added, both runs returned null at the two-page remap. On `e3c6dbd7`, both runs passed and all three bytes matched. - `RUST_TEST_THREADS=1 cargo test --locked -p victory-hle` passed on the patch with 470 unit tests and 2 integration tests passing, and 13 unit tests ignored. - With four test threads, the full crate run failed the same existing range-lock test on both the clean base and this change. See #2439. - `cargo xtask policy --staged` passed. `cargo clippy --locked -p victory-hle --all-targets -- -D warnings` reported the same five findings in `victory-gpu` on both revisions. Tracked by #4708. ## Checked for overlap - [x] Searched open and closed issues and PRs for the mapping call, contiguous remaps and placeholder coalescing. Checked the heads of all 173 open PRs touching `xmem.rs` among the 934 open PRs at the time of review. No matching fix found. Related work includes Wine mappings in #2455, alias-source locking in #4143 and unchanged mapping batches in #4607.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 05:52:58 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/4761/head:github-bot/gh-4760'
git switch 'github-bot/gh-4760'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-4760'
git switch 'github-bot/gh-4760'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-4760'
git switch 'github-bot/gh-4760'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-4760'
git switch 'main'
git merge --squash 'github-bot/gh-4760'
git switch 'main'
git merge --ff-only 'github-bot/gh-4760'
git switch 'main'
git merge 'github-bot/gh-4760'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!4761
No description provided.