Repository navigation
Conversation
Wine's K32GetProcessMemoryInfo leaves PrivateUsage 0, and its PagefileUsage is not the commit: on macOS it is the Mach task's virtual size (~41 GiB, which a commit does not change). process_private_bytes() took PagefileUsage then, so TitleMemoryStatus and XMemGetWorkingSetStatistics clamped "used" to the title memory budget and told the title it had no memory available, and the activity log's commit figure (which read PrivateUsage itself) was 0. process_private_bytes() now falls back to the sum of the MEM_COMMIT + MEM_PRIVATE regions of the address space (VirtualQuery), and host.rs's activity log uses it instead of reading PrivateUsage itself. Windows, where PrivateUsage is filled, is unchanged. Measured under CrossOver 26.3 on macOS: with the old fallback, a 256 MB commit moved PagefileUsage from 44,183,973,888 to 44,183,977,984 bytes (+4 KiB). New test process_private_bytes_counts_a_commit: a 256 MB commit shows in both the counter and the region sum.
|
Verification on RTX 3060 Ti (Windows 11), branch merged with current
Thanks! |
bmjask
left a comment
There was a problem hiding this comment.
No concrete code defect found. The VirtualQuery fallback correctly sums committed private regions when K32 PrivateUsage is zero/fails, and opt-in 2s activity sampling keeps cost bounded. Merge readiness still needs the required description/smoke evidence. The 256 MiB process-wide allocation test has parallel flake/resource risk (it permits 64 MiB concurrent freeing); consider a controlled lower-allocation seam or document the cost. An independent Win11 report also notes an intermittent parallel abort worth reproducing.
|
Read from the diff at 619cbb2 (not run). The fix is right for the counter, but on Wine |
Under 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.