Write watch: don't ask the kernel again about ranges it refused #2834
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2834"
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 trustno1-coder/VIctory-NVIDIA. Originally posted by 101Leafy on 2026-11-29T17:53:32Z.
GetWriteWatch refuses ranges that cross reservations, and ranges over views. Today every frame asks the kernel about the same refused ranges again, though nothing about them changed, and each refusal costs a kernel call before the range falls back to guards.
This keeps the refused ranges per thread (no lock shared between threads) and skips asking about them again for 64 frames. A refusal is dropped early when the title allocator reports write-watched memory over it through
title_memory_allocated, since that is the only change that can turn a refusal into an answer. Freed memory and mapped or unmapped views stay refused. A small hashed bitmap of the MiB that refused ranges touched keeps allocations elsewhere from taking the lock.Keeping a refusal by mistake only costs time: the range is guarded as any refused range is, and the next asking after it finds every page written since.
VICTORY_REFUSED_KEEP=0turns it off (every asking goes to the kernel, as before).Measured on our fork's build, 20 s of a title's intro (60-80 s in):
The picture was unchanged.