host_gpu: asynchronous write watches for write-hot regions on Linux #1147
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
GPU
GUI
help wanted
question
Shaders
Video
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/KytyPS5--KytyPS5!1147
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1147/head"
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?
@abokhalill on GitHub · 2026-10-07 15:34 UTC · original
abokhalill:async-write-watch→main· +732 −0 · 8 files · 1 commits · closed without mergingCPU writes to GPU-cached memory are tracked with
mprotectandSIGSEGV. Every first write takes a signal and anmprotectundermmap_lock, and every re-arm on upload takes anothermprotectwith a TLB shootdown. These faults serialize across threads, so the more guest threads write, the slower each write gets (#1081).This PR moves the write watches of regions that keep faulting to userfaultfd async write protection (
UFFD_FEATURE_WP_ASYNC). The kernel lifts the protection on the first write without a signal, andPAGEMAP_SCANcollects and re-arms the written pages at each submission and satisfiedWAIT_REG_MEM. Access watches stay onmprotect. Idle regions go back tomprotect. Opt-in withKYTY_ASYNC_WRITE_WATCH=1PageManager+MemoryTracker, N threads writing 384 pages each per frame, then a re-upload:Tested on Linux 6.8 with RTX 6000 Ada.
@coderabbitai[bot] on GitHub · 2026-10-07 15:43 UTC · original · edited 2026-10-07 15:46 UTC
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
23ab6c46-d851-4853-81e3-1abfa0704e01📥 Commits
Reviewing files that changed from the base of the PR and between 5da5200677f8bd12ff137d323c6b407df4121164 and
d1830999f7.📒 Files selected for processing (3)
src/graphics/host_gpu/memoryTracker.hsrc/graphics/host_gpu/pageManager.hsrc/graphics/host_gpu/renderer/renderContext.hIncluded review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
📝 Walkthrough
Walkthrough
Linux
PageManageradds optional asynchronous write watches, write harvesting, and idle demotion.RenderContextandMemoryTrackeruse harvested writes to update caches and CPU-modified memory state.GuestGpuharvests writes before submissions and after satisfied waits. Linux tests cover harvesting and watch lifecycle behavior.Suggested reviewers:
nmzikPriority: ➖ Normal
Change: Feature
Merge Risk: ⚪ Minimal · up to
d1830The change adds an opt-in Linux write-watch feature. No concrete merge-blocking issue was identified in the supplied context.
🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment
@coderabbitai helpto get the list of available commands.Pull request closed