startup: system commit, job limit and page-pool counters in the budget line #2825
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2833"
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?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:42:56Z.
Part of #870
Fixes #2832
Related: #1199 (physical-page sections and commit; not changed here).
What this unblocks: a run that ends on error 1455 or 8 can be attributed from its log to the job memory limit, the system commit or the physical-page pool.
What changed
src/startup_stubs/commit_state.h(new, header only):system_commit()(GlobalMemoryStatusEx),job_memory()(QueryInformationJobObject,JobObjectExtendedLimitInformation:JobMemoryLimit,PeakJobMemoryUsed),job_limit_reached()(limited job whose peak is within 256 MiB of its limit; a refused request never reaches the limit itself), and the formatting of the new text.report_budget()(d3d12_xs_device.cpp): thex2w-budgetline ends withcommit=<used>/<limit> avail=<free>(MiB),sections=<n> slabs=<n> slots=<in use>/<free>(from the existingx2w_xmem_page_stats/x2w_xmem_slab_stats) andjob_peak=<MiB> job_limit=<MiB|none>. Each isn/awhen unreadable.log_apply_failure()(xmem_mapped_pages.cpp): the first three commit failures (error 1455 or 8) also logx2w-xmem commit exhausted at <call> (error N): job memory limit N GiB reached (run.ps1 -MemoryGiB); ...(orjob memory limit not reached), then the job numbers, the system commit, the pool counters and theX2W_XMEM_LAZY_COMMIT=1(run.ps1 -LazyMemory) hint. The caller already holds the pool mutex.tools/startup/triage_run.py: the budget line is read with or without the new fields (all-or-nothing group).docs/startup-runtime.md: the new fields and the failure line.What stays the same
No allocation, mapping or release behaviour changes; only text is added.
Tests
tests/startup_commit_state_check.cpp(new, CTeststartup_commit_state): text of the commit, job and failure lines (known and unknown values; job limit reached, roomy, unlimited, no job), which error codes count, the system commit is consistent (used + avail = limit to a MiB), and a real job with a 4 GiB memory limit read back (skipped only under Wine, which does not keep the limit).tests/startup_triage_run_check.py: budget lines with the commit, pool and job fields (known andn/a) are read; a malformed field or a trailing path is still rejected. The extended case fails against the previoustriage_run.py.Verification
python3 -B tests/startup_triage_run_check.py: 0 failedx86_64-w64-mingw32-g++ -std=c++17 -static -Wall -Wextra -Isrc tests/startup_commit_state_check.cpp+wine: PASSxmem_shim,d3d12_xs_device_obj,d3d12_xs_shim,startup_commit_state_check;startup_commit_statedev 1/1 and release 1/1; one mutant (job-limit branch dropped) caught.Source: Microsoft Learn, Win32
GlobalMemoryStatusEx,QueryInformationJobObject/JOBOBJECT_EXTENDED_LIMIT_INFORMATION, system error codes 8 and 1455; earlier code of this repo (x2w_xmem_page_stats,x2w_xmem_slab_stats,report_budget).Real-hardware testing: @Makto94 - thanks for the help.
AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-26T12:46:46Z.
Independent review of head
83828d2498: PASS.Verification:
ctest -R '^startup_commit_state$': dev 1/1 and release 1/1.tests/startup_triage_run_check.pypasses there too.job_limit_reachedset from 256 MiB to 0 makesstartup_commit_statefail on "the job limit is the cause only for a limited job near its limit" and on the exhausted line with the job limit reached (peak 14250 of 14336 MiB), so the test sees the limit rule.python3 -B tests/startup_triage_run_check.py: 0 failed.commit_state.h: text only, no allocation, mapping or release change.AI-assisted; commands listed were executed locally.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T12:46:53Z.
Codex Review Summary: ❌ Failed
This comment shows the latest Codex review activity on this pull request.
We couldn’t complete this review. Comment
@codex reviewto try again.83828d2ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-26T12:46:55Z.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.
Imported from R0Y00/Xbox2Windows. Originally posted by SimSalabimse on 2026-11-26T16:07:04Z.
Hardware and WARP result for head
83828d2498f79bb73021b0add6c4016794d94a09: all pass. Part of #870.Environment: Windows 11 25H2 (26200), MSVC 19.42,
devpreset, NVIDIA GeForce RTX 4070 Ti, driver 621.35 (32.0.16.2135). Tests run serially, one ctest process.Command
Result (measured): 40/40 passed, exit code 0.
startup_commit_state.xmem_mapped_pages_commit,xmem_mapped_pages_commit_failureandxmem_shim_mapped_pages(the PR editsxmem_mapped_pages.cpp).startup_triage_runandruntime_startup_triage_run_cli_check.d3d12_xs_device.cpp:startup_resource_budget(WARP and hardware, debug layer 0 and 1, with the inline controls) andstartup_resource_retire*(WARP and hardware variants).What this shows: the changes to the commit-state text and the budget line do not break the budget and retire device tests on an NVIDIA adapter, and
startup_commit_statepasses.What this does not show: I did not run a game, so I did not read the new commit, job and page-pool fields from a real
x2w-budgetline.AI-Assisted
Imported from R0Y00/Xbox2Windows. Originally posted by pigalot on 2026-11-27T19:31:11Z.
Review: APPROVED
Independently reviewed
83828d24integrated overmain88cddb09(treeef21d6cb, clean merge).What I traced.
log_apply_failureruns withmemory.mutexheld. It doesn't lock again:slab_count(),slots_in_use()andslots_free()are plain getters, andlogfonly writes.report_budgetcalls,x2w_xmem_page_statsandx2w_xmem_slab_stats, take the mutex themselves, so thed3d12_xsside calls them unlocked, which is correct.GetModuleHandleExW(0, ...)reference is released.snprintftruncates safely.What I ran. I built
startup_commit_state_check,xmem_shim,xmem_shim_test_controlsandd3d12_xs_shimindevandrelease, then ran:ctest --test-dir out/build/<preset> --no-tests=error -j 1 -V -R '^(startup_commit_state|xmem_mapped_pages_commit|xmem_mapped_pages_commit_failure|xmem_shim_mapped_pages|xmem_shim_page_runs|startup_triage_run|runtime_startup_triage_run_cli_check)$'/O2, with no skips.note:line.End to end. No registered test reaches the new
xmem_mapped_pages.cppline.xmem_mapped_pages_commit_failuretakes the strictXMemMapPhysicalPagespath, which doesn't calllog_apply_failure. I ran the same check withX2W_XMEM_PERMISSIVE=1added, so the refused commit goes throughlocal_apply_locked:stage=section-backing ... error=1455line:x2w-xmem commit exhausted at XMemMapPhysicalPages (error 1455): job memory limit not reached; job_peak=11 job_limit=none; system commit=<used>/<limit> avail=<free>; pool sections=0 slabs=0 slots=0/0; X2W_XMEM_LAZY_COMMIT=1 ...Mutant. Reading
info.ProcessMemoryLimitinstead ofinfo.JobMemoryLimitinjob_memory()failsstartup_commit_stateatFAIL a real job is read back. Restored, it passes.startup_commit_stateis new, so it is not registered onmain.git diff --checkis clean.Non-blocking notes.
xmem_mapped_pages_commit_failurewith aPASS_REGULAR_EXPRESSIONoncommit exhausted atwould keep the xmem side of this covered. As it stands, only the formatter is tested.reporteduses a bareInterlockedIncrement. After 2^31 commit failures it wraps negative and logs again.x2w_local::first_calls(reported, 3)is the existing helper for this gate.Verdict: approve on
83828d24.Environment:
CI:
Build and test on Windowspasses on83828d24. There are no review threads.This reply was AI-assisted.