XMem: a page mapping that already shows the same pages is not made again #1598

Merged
mizzied merged 1 commit from upstream-pr/1598 into main 2026-11-29 08:16:55 +00:00
mizzied commented 2026-11-28 22:11:02 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by mizzied on 2026-11-28T22:11:02Z.


What it does. XMemMapPhysicalPages (and with it the scatter form) and the page-mapping copy (map_alias) now leave the views alone when every page asked for is already shown at its address. The bytes are the same and the views' guards stay valid, so mapping them again only cost time. The counts go to the log (the first, then every 4,096th). VICTORY_REMAP_SAME=0 maps them again as before.

How it was tested. RTX 5070, Windows 11.

  • Changed tests: two existing tests that remapped the same pages to exercise a mapping now move a page first.
  • New test: a mapping of the same pages leaves the view alone, shown by a protection set on the view surviving, which it wouldn't with a new view. Mappings of other pages, or after a page moved, still happen as before.

cargo test --workspace passes apart from repository_passes_policy, which already fails on main: lower.rs is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on main, none on lines this PR changes.

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545063753 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1598). Originally posted by [mizzied](https://github.com/mizzied) on 2026-11-28T22:11:02Z. --- **What it does.** `XMemMapPhysicalPages` (and with it the scatter form) and the page-mapping copy (`map_alias`) now leave the views alone when every page asked for is already shown at its address. The bytes are the same and the views' guards stay valid, so mapping them again only cost time. The counts go to the log (the first, then every 4,096th). `VICTORY_REMAP_SAME=0` maps them again as before. **How it was tested.** RTX 5070, Windows 11. - **Changed tests:** two existing tests that remapped the same pages to exercise a mapping now move a page first. - **New test:** a mapping of the same pages leaves the view alone, shown by a protection set on the view surviving, which it wouldn't with a new view. Mappings of other pages, or after a page moved, still happen as before. `cargo test --workspace` passes apart from `repository_passes_policy`, which already fails on `main`: `lower.rs` is over the 640 KiB file-size limit there (#1493 raises it). Clippy reports only the 16 findings already on `main`, none on lines this PR changes.
Sign in to join this conversation.
No reviewers
No labels
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.

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