xmem, d3d12: cut write-watch rearm, scan-run, and arena slab overhead #475
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/475"
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 brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T13:21:42Z.
Summary
Reduces placement write-watch scan, rearm, and arena allocation overhead in
xmemandd3d12:UNTRACKEDrearms & keep unheld pages of untracked watches off the scan list:d3d12'sWatchand skip redundantTuxBoxRearmPhysicalWatchFFI calls when the cell is unchanged (UNTRACKEDwithoutWRITTEN) forHELD,SECTION, orUNBACKED. XMem already setsWRITTENwhenever backing/hold state changes (and wakes!handle.trackedhandles inwatch_held_pages(1)). On#464default section-backedmain(see #472), this skips tens of millions of redundantSECTIONrearm calls per run.Handle.tracked) in XMem and only list targets for tokens that belong to at least one tracked handle (two-passPool::rearmandTracking::detachcleanup).PrivateArenaslabs, per-page arena holds, and held-gap scan guard:256 * 64 KiB)ArenaSlabs, recycling free slabs (Arc::strong_count == 1, zeroing recycled slots, pruning excess idle slabs) and tracking holds per arena page (pinned_arena_pages/arena_page_has_hold).GetWriteWatch(RESET)runs across gaps containingimport_viewsorimport_arenaspages whenheld_watch != Some(true), preventing write-watch resets on active RADV userptr pages during scans.PrivateSpanplaceholder reservations:4 MiB(64 * 64 KiB) placeholder chunks perPrivateSpan(reserve_private_range+ on-demandcommit_private_range_protect) bounded by the reservation and existing spans/deferred unmaps, so sparse 64 KiB mappings share one OS allocation and write-watch VMA.TUXBOX_TRACE_XMEM_BACKING=1):slabs=and a separatescan statsline (runs=(span= arena= own=),spans=,targets=, 5 slock/rebuild/gww/dirtycounters; zero overhead when unset).Tested
GE-Proton11-14Wine):tests.test_repository_hygiene:7/7pass.tuxbox-xmem:29/29pass (including 4 new tests covering untracked unheld pages, held-gap scan guard, arena slabs, and chunkedPrivateSpanscans, plus#464section-backing tests).tuxbox-d3d12 device::placement:92/92pass (includingunchanged_untracked_textures_skip_redundant_rearms).1002:73bf, RADV, Mesa 26.3.1, GE-Proton11-14) —tuxbox.py check:123/123Lanes & fixtures,22/22D3D12 regression controls, shader translator on GPU, all CPU/CI suites.1002:164e, RADV, Mesa 26.3.1, GE-Proton11-14) —tuxbox.py check:122/122Lanes & fixtures,22/22D3D12 regression controls, shader translator on GPU, all CPU/CI suites.TUXBOX_XMEM_PRIVATE_VIEWS=1(with#462):PrivateSpanVMAs dropped from~97,290to4,449(22x fewer),GetWriteWatchruns/scan dropped from4,258to369(11.5x fewer),placement scandropped from12.7 msto9.79 ms/scan,live_arenasdropped from3,137(1,170 MiB) to36slabs (576 MiB),unaccounted(rearm/etc.) dropped from19.0%to12.6%of wall time, zero GPU faults orERROR_BUSY.#464section-backedmain(6e2c5dabcombined with the parallel placement digest PR): ran 17+ minutes (743D world windows) with zero crashes or GPU faults, skipping27.2MredundantSECTIONrearms (placement scan0.9%of wall time).1002:73bfand1002:164e); NVIDIA still needs to run checks.Checks
No evidence JSON changed.