Skip to content

HLE: recycle freed XMem page numbers - #1490

Closed
Calvix2k wants to merge 1 commit into
Marvisak:mainfrom
Calvix2k:codex/xmem-page-reuse-036
Closed

Calvix2k wants to merge 1 commit into
Marvisak:mainfrom
Calvix2k:codex/xmem-page-reuse-036

Conversation

@Calvix2k

Copy link
Copy Markdown
Contributor

Summary

Recycle page numbers removed by XMemFreePhysicalPages and prefer them in subsequent XMemAllocatePhysicalPages calls. This prevents the title's packed 21-bit page-number field from eventually wrapping after repeated allocation/free churn, even when few pages remain live.

Addresses VIC-BT-036 from the audit in #1249.

Verification

  • cargo test -p victory-hle --lib — 95 passed
  • cargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings — passed
  • Repository pre-commit asset-policy hook — passed

The full workspace test run on this Windows 10 machine still has 15 GPU shader tests that require an SM 6.6 hardware or WARP device; the targeted HLE suite passes.

@DenRakEiw DenRakEiw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified locally merged onto origin/main (Windows 11 x64, Rust 1.98.1 MSVC):

  • cargo test -p victory-hle --lib xmem:: — 11 passed, 0 failed (including freed_physical_page_numbers_are_reused_before_growing_the_pool)
  • cargo clippy -p victory-hle --all-targets — 0 warnings
  • cargo xtask policy — ok

Clean free-list recycling of freed XMem physical page numbers in Physical::allocate_page_number. Looks good.

AI-assisted (Gemini 4 Neon).

nazmi added a commit to nazmi/VIctory that referenced this pull request Nov 24, 2026
…le validation

Integrated: Marvisak#1282 (fold a conditional branch to its fallthrough, with a guard
so s_cbranch_cdbg* stays refused - without the guard the fold silently
accepted four debug branches that effects() refuses), Marvisak#1360 and Marvisak#1362
(hardware tests for s_min/s_max and s_lshl_add), Marvisak#1490 (freed XMem page
numbers are reused instead of growing the pool), Marvisak#1607 (1D textures accept
only GFX10 1D swizzle modes rather than computing a size from an invalid
layout).

Refused: Marvisak#1523 (withdrawn by its author; three NVIDIA GPUs all cap at exactly
1,000,000). Duplicate: Marvisak#512.

Gate at c7c2a72: fmt 0 differing, both Clippy gates 0 errors, policy 219
files, workspace 685 passed / 0 failed with the 10 documented GPU skips. One
earlier run in this session reported a single failure that did not reproduce
in a full re-run; it is recorded as unreproduced rather than dismissed.
@Marvisak

Copy link
Copy Markdown
Owner

Automated triage for the maintainers. Closing because another open pull request covers the same change.

See #1445. Same page-number reuse as #1445 without its limit check, so numbers the title cannot represent are still handed out at the limit.

If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.

@Marvisak Marvisak closed this Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants