Skip to content

pool: make JIT-pool exhaustion name the images that consumed the pool - #639

Open
TimmyTurner51 wants to merge 1 commit into
willfaust:mainfrom
TimmyTurner51:pr/pool-img-census
Open

TimmyTurner51 wants to merge 1 commit into
willfaust:mainfrom
TimmyTurner51:pr/pool-img-census

Conversation

@TimmyTurner51

Copy link
Copy Markdown

Why

When the JIT pool exhausts, the log says which load failed ([jit-pool] EXHAUSTED) and how much is free ([pool-capacity]), but never what filled it — and that is the question that decides the fix.

The existing per-image copy line is ERR(...)-level:

ERR("iOS JIT: copied image %p+0x%lx → pool %p (offset 0x%lx, used 0x%lx/0x%lx)\n", ...)

so under WINEDEBUG=-all — the setting a shipping run uses — it is filtered out entirely. A post-mortem log therefore cannot attribute pool consumption at all. In a recent failure (Forza Horizon 6, 736 MB of a 768 MB pool, freelist=0) this was the missing piece: the logs could name windows.gaming.input.dll as the load that failed, but not the images whose copies had used the 736 MB, and the breakdown was uncomputable from the capture.

What

Records cumulative pool bytes per module — top 8, lock-guarded, evicting the smallest so the list always holds the largest consumers — and dumps it from the image-exhaustion path next to the existing EXHAUSTED line:

[pool-img-top] 8 module(s) accounted; cumulative pool bytes copied:
[pool-img-top]     184.3 MiB  \??\C:\...\forzahorizon6.exe
[pool-img-top]      68.5 MiB  \??\C:\...\amd_fidelityfx_upscaler_dx12.dll
...

Cumulative is the correct measure: image pool copies are not returned while the process lives, so "who copied the most" is exactly "who owns the pool".

Risk

None to allocation. This is diagnosis only:

  • no change to the allocator, the freelist, the bump cursor, or any failure return
  • no new allocation path; the dump goes to stderr at a point that already writes stderr
  • the bookkeeping is a small fixed array behind a mutex taken once per image copy

Verification

  • compiles clean for arm64 against the current tree
  • host checks: 296 passed, 2 pre-existing environmental failures (missing python compression module; dxmt submodule not patched), 0 regressions

Made with Cursor

[jit-pool] EXHAUSTED reports which load just failed, and [pool-capacity]
reports how much is free, but nothing reports what filled the pool -- which is
the question that decides the fix. The per-image copy line is ERR(...)-level,
so WINEDEBUG=-all (the shipping setting) filters it and a post-mortem log
cannot answer it. That gap is why a recent investigation could not attribute
736 MB of pool consumption from a captured log at all.

Records cumulative pool bytes per module (top 8, lock-guarded) and dumps them
from the image-exhaustion path. Cumulative is the right measure here: image
pool copies are not returned while the process lives, so 'who copied the most'
is 'who owns the pool'.

Diagnosis only -- no allocation behaviour changes, no new allocation path, and
the dump is taken at a point that already prints to stderr.

Build: compiles clean for arm64 against the current tree. Host checks: 296
passed, 2 pre-existing environmental failures (missing python 'compression'
module; dxmt submodule not patched), 0 regressions.

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

2 participants