kernelx: the process's commit from VirtualQuery when PrivateUsage is 0 #2362
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
goal:world-load
good first issue
help wanted
invalid
keep-open
off-goal
question
stale
test-only
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/xcl-dev--xcl!2362
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2362"
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?
@vakaobr on GitHub · 2026-11-25 16:40 UTC · original
vakaobr:kernelx/private-usage-zero→main· +44 −15 · 2 files · 1 commits · draftUnder Wine, XCL tells a title how much memory it uses from the wrong counter. Wine's
K32GetProcessMemoryInfoleavesPrivateUsage0, andprocess_private_bytes()then falls back toPagefileUsage, which under CrossOver on macOS is the process's virtual size (~41 GiB) and does not move when memory is committed.TitleMemoryStatusandXMemGetWorkingSetStatisticsclamp that to the title memory budget, so a title on a Mac is told it has no memory available, and the activity log's commit figure (which readsPrivateUsageitself) is 0. WhenPrivateUsageis 0, the commit is now the sum of the process'sMEM_COMMIT+MEM_PRIVATEregions fromVirtualQuery. Windows, wherePrivateUsageis filled, is unchanged.Part of #258. It touches the same lines in
host.rsas #1097, which changes only the activity log and leaves the title-memory functions onPagefileUsage. On Wine under Linux this uses theVirtualQuerysum too, where #1097 keepsPagefileUsage.What is in it
crates/xcl/src/hle/kernelx.rs:process_private_bytes()falls back to a newcommitted_private_bytes()(aVirtualQuerywalk of the address space) instead ofPagefileUsage; new testprocess_private_bytes_counts_a_commitchecks that a 256 MB commit shows in both.crates/xcl/src/host.rs: the activity log's "committed by the process" figure usesprocess_private_bytes().Tested
x86_64-pc-windows-gnu, debug, onmain65fc114.cargo test -p xcl --lib --target x86_64-pc-windows-gnu --no-run, then each test ofhle::kernelx::testsin its own process in the CrossOver bottle (--exact <test> --test-threads=1): 42 tests, 41 passed, 0 failed, 1 ignored (scatter_timing), 0 SKIPPED.physical_home_without_sparse_windows_uses_coherent_windowpassed but its process did not exit within 120 s once; three reruns passed and exited normally.process_private_bytes_counts_a_commitfails:commit 44183973888 -> 44183977984(+4 KiB on a 256 MB commit). With the fix it passes.Regression run
scripts/smoke.ps1on.Not tested
hle::kernelx::testsmodule ran.VirtualQuerywalk when a title callsTitleMemoryStatus/XMemGetWorkingSetStatisticsoften (not measured).AI use
main, checked open PRs for overlap, built the tests, ran thekernelxtests and the check with the fix taken out under CrossOver, and drafted the commit message and this description.@DavidM1911 on GitHub · 2026-11-25 18:50 UTC · original
Verification on RTX 3060 Ti (Windows 11), branch merged with current
main:cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)Thanks!
@Oliwettoo on GitHub · 2026-11-25 22:44 UTC · original
Read from the diff at
619cbb2(not run). The fix is right for the counter, but on Wineprocess_private_bytes()now walks the whole address space withVirtualQueryon every call, and its callers are title-facing:TitleMemoryStatusandXMemGetWorkingSetStatistics, which engines can poll often to size pools and texture streaming. A title with many small regions (a 24 GB reservation of 64 KiB pages, committed piecemeal) has thousands of regions to visit each time. Caching the sum for a short interval (e.g. 250 ms, or refreshed from the 2 s activity tick) would keep a polling title off that walk. Worth a timing under Wine on a retail title before merging.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.