perf(libc): remember clean pages once per run in Windows write collects #3864

Merged
CnRJay merged 1 commit from upstream-pr/3864 into main 2026-10-14 18:30:24 +00:00
CnRJay commented 2026-10-11 18:10:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-11T18:10:32Z.


What

WindowsMappings::Collect (the write-watch walk behind GuestMemory::CollectWrites) cost PPSA28416 (STAR WARS: Galactic Racer, UE5) about 16% of its render thread: ~62k collects and ~625 GiB of guest ranges walked per 10 s, mostly image surfaces collected by ShaderResources::precollectImages and PrepareDrawBindings (10-60 MiB each).

#5062 has since merged two of the three parts this PR first carried: the in-order view walk and the collectable() fast path. This rebase keeps only the part #5062 doesn't cover.

A resetting Collect remembered the clean pages of every 16 KiB view separately: one rememberClean call, an erase and an insert in cleanRanges, per page found clean. Now Collect keeps one pending run of clean pages and remembers it once, when the run breaks or the walk ends, and before every early return (a PAGE_NOACCESS view, a full page buffer, a resident view, private memory). The run covers only pages behind the cursor, so the cleanRanges lookups ahead see the same map as before. Neither protectSubpages nor collectResident touches cleanRanges.

The pages reported, the stamps and the clean ranges left behind are the same as before.

Tested

Windows 11, WinLibs GCC 15.2.0, Release, RTX 4080, rebased onto main 5ef619a91.

  • Full ctest: 1198 of 1198 pass (14 skipped: display, udmabuf and stencil-export tests this machine can't run), including guest_memory, windows_write_watch, agc_write_tracking, agc_shared_write, agc_shared_write_partial_collect and _two_pass.
  • tools/check_conventions.py --base upstream/main passes.
  • The PPSA28416 measurement in the first version of this PR (collect time 1.8 s -> 0.1 s per 10 s under APS5_PROFILE_DRAW) was for all three parts together, before #5062. The share of the remaining part on current main has not been measured again.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4821206918 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-11T18:10:32Z. --- ### What `WindowsMappings::Collect` (the write-watch walk behind `GuestMemory::CollectWrites`) cost PPSA28416 (STAR WARS: Galactic Racer, UE5) about 16% of its render thread: ~62k collects and ~625 GiB of guest ranges walked per 10 s, mostly image surfaces collected by `ShaderResources::precollectImages` and `PrepareDrawBindings` (10-60 MiB each). #5062 has since merged two of the three parts this PR first carried: the in-order view walk and the `collectable()` fast path. This rebase keeps only the part #5062 doesn't cover. A resetting `Collect` remembered the clean pages of every 16 KiB view separately: one `rememberClean` call, an erase and an insert in `cleanRanges`, per page found clean. Now `Collect` keeps one pending run of clean pages and remembers it once, when the run breaks or the walk ends, and before every early return (a `PAGE_NOACCESS` view, a full page buffer, a resident view, private memory). The run covers only pages behind the cursor, so the `cleanRanges` lookups ahead see the same map as before. Neither `protectSubpages` nor `collectResident` touches `cleanRanges`. The pages reported, the stamps and the clean ranges left behind are the same as before. ### Tested Windows 11, WinLibs GCC 15.2.0, Release, RTX 4080, rebased onto `main` 5ef619a91. - Full `ctest`: 1198 of 1198 pass (14 skipped: display, udmabuf and stencil-export tests this machine can't run), including `guest_memory`, `windows_write_watch`, `agc_write_tracking`, `agc_shared_write`, `agc_shared_write_partial_collect` and `_two_pass`. - `tools/check_conventions.py --base upstream/main` passes. - The PPSA28416 measurement in the first version of this PR (collect time 1.8 s -> 0.1 s per 10 s under `APS5_PROFILE_DRAW`) was for all three parts together, before #5062. The share of the remaining part on current `main` has not been measured again. ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed in [TechnicalDebt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/TechnicalDebt.md#silent-stubs) - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] AI-assisted: yes
oneandonlydean commented 2026-10-11 23:17:54 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-11T23:17:54Z.


Conflicts with main in core/libs/prx/libc/include/WindowsMappings.hpp since #3783, which changed Collect; please rebase and repeat the PPSA28416 collect-time measurement on the new base.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6115013940 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#issuecomment-6115013940). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-11T23:17:54Z. --- Conflicts with main in `core/libs/prx/libc/include/WindowsMappings.hpp` since #3783, which changed `Collect`; please rebase and repeat the PPSA28416 collect-time measurement on the new base.
EagleBearerYS commented 2026-10-12 13:17:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by EagleBearerYS on 2026-10-12T13:17:28Z.


A data point on the new base, from another title. I ported this PR's three parts onto main's Collect after #3783 and kept #3783's clean-range memory:

  • an iterator hint instead of views.find per page;
  • clean runs remembered once per run instead of once per page;
  • the clean-range skip in collectable().

The diff is at the end, in case it saves you the rebase.

Planet of Lana (PPSA19450) on Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 3070 Laptop. The base is main d146ec1b6 plus other changes I'm testing (#494 rebased, #2863, #290, #2904, #4320 and two unmerged driver changes), with and without the port. Both runs are the same scene, Lana standing in the first village, with APS5_PROFILE_DRAW=1 and the worker sampler on:

presents per 10 s us per draw packet readTarget per draw lookup per draw
without the port 91.6 114.0 10.1 us 19.8 us
with the port 111.4 92.2 1.7 us 8.0 us

Before the port, GuestArena::WindowsMappings::Collect was 19% of the queue-0 worker's samples: a map lookup and a clean-range insert per 16 KiB page, plus the second walk in collectable(). Lana's direct memory is in shared views, and the resident-target refresh walked about 1,200 pages per lookup, because the collect epoch moves at every submission and wait (about 440 submissions and 1,050 waits per second here). With the port, Collect no longer shows in the profile, and no AnyPS5 function is above ~1.3%.

agc_shared_write*, agc_write_tracking and guest_memory pass with the port on main c36fd0a0e, in the same test stack. The full suite was not run with it.

The port, on main c36fd0a0e (WindowsMappings.hpp)
diff --git a/core/libs/prx/libc/include/WindowsMappings.hpp b/core/libs/prx/libc/include/WindowsMappings.hpp
index 9d33b9b0b..57e3bd301 100644
--- a/core/libs/prx/libc/include/WindowsMappings.hpp
+++ b/core/libs/prx/libc/include/WindowsMappings.hpp
@@ -222,6 +222,13 @@ public:
         *count = 0;
         const auto end = address + bytes;
         if (clear && !collectable(address, end)) return false;
+        std::uintptr_t cleanStart = 0;
+        std::uintptr_t cleanEnd = 0;
+        const auto flushClean = [&] {
+            if (cleanEnd > cleanStart) rememberClean(cleanStart, cleanEnd);
+            cleanStart = cleanEnd = 0;
+        };
+        auto hint = views.end();
         for (auto cursor = address; cursor < end;) {
             const auto nextClean = cleanRanges.upper_bound(cursor);
             if (nextClean != cleanRanges.begin()) {
@@ -232,16 +239,21 @@ public:
                 }
             }
             const auto base = cursor & ~(pageBytes - 1);
-            const auto found = views.find(base);
+            const auto found = findView(base, hint);
+            hint = found;
             if (found != views.end()) {
                 auto& view = found->second;
                 const auto stop = std::min(std::min(end, base + pageBytes), nextClean == cleanRanges.end() ? end : nextClean->first);
-                if (view.protection == PAGE_NOACCESS) return false;
+                if (view.protection == PAGE_NOACCESS) {
+                    flushClean();
+                    return false;
+                }
                 const bool pinned = view.page->pins != 0;
                 if (pinned || view.seen != view.page->generation) {
                     const auto needed = (stop - cursor + 4095) / 4096;
                     if (needed > capacity - *count) {
                         for (auto at = cursor; *count < capacity; at += 4096) pages[(*count)++] = reinterpret_cast<void*>(at);
+                        flushClean();
                         return true;
                     }
                     for (auto at = cursor; at < stop; at += 4096) pages[(*count)++] = reinterpret_cast<void*>(at);
@@ -256,10 +268,15 @@ public:
                         other.armed = true;
                     }
                     if (cursor == base && stop == base + pageBytes) view.seen = view.page->generation;
-                    rememberClean(cursor, stop);
+                    if (cleanEnd != cursor) {
+                        flushClean();
+                        cleanStart = cursor;
+                    }
+                    cleanEnd = stop;
                 }
                 cursor = stop;
             } else {
+                flushClean();
                 const auto memory = query(cursor);
                 if (memory.State != MEM_COMMIT || memory.Type != MEM_PRIVATE) return false;
                 const auto stop = std::min(end, reinterpret_cast<std::uintptr_t>(memory.BaseAddress) + memory.RegionSize);
@@ -272,14 +289,24 @@ public:
                 cursor = stop;
             }
         }
+        flushClean();
         return true;
     }
 
 private:
     bool collectable(std::uintptr_t address, std::uintptr_t end) {
+        auto hint = views.end();
         for (auto cursor = address; cursor < end;) {
+            if (const auto nextClean = cleanRanges.upper_bound(cursor); nextClean != cleanRanges.begin()) {
+                if (const auto clean = std::prev(nextClean); cursor < clean->second) {
+                    cursor = std::min(end, clean->second);
+                    continue;
+                }
+            }
             const auto base = cursor & ~(pageBytes - 1);
-            if (const auto found = views.find(base); found != views.end()) {
+            const auto found = findView(base, hint);
+            hint = found;
+            if (found != views.end()) {
                 if (found->second.protection == PAGE_NOACCESS) return false;
                 cursor = std::min(end, base + pageBytes);
                 continue;
@@ -313,6 +340,14 @@ private:
         std::uint64_t offset;
         std::uint32_t hostWrites;
     };
+    std::map<std::uintptr_t, View>::iterator findView(std::uintptr_t base, std::map<std::uintptr_t, View>::iterator hint) {
+        if (hint != views.end()) {
+            if (hint->first == base) return hint;
+            if (const auto next = std::next(hint); next != views.end() && next->first == base) return next;
+        }
+        return views.find(base);
+    }
+
     void forgetClean(std::uintptr_t start, std::uintptr_t end) {
         auto it = cleanRanges.lower_bound(start);
         if (it != cleanRanges.begin() && std::prev(it)->second > start) --it;
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6125063892 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#issuecomment-6125063892). Originally posted by [EagleBearerYS](https://github.com/EagleBearerYS) on 2026-10-12T13:17:28Z. --- A data point on the new base, from another title. I ported this PR's three parts onto `main`'s `Collect` after #3783 and kept #3783's clean-range memory: - an iterator hint instead of `views.find` per page; - clean runs remembered once per run instead of once per page; - the clean-range skip in `collectable()`. The diff is at the end, in case it saves you the rebase. Planet of Lana (PPSA19450) on Windows 11, MinGW-w64 GCC 15.2.0 (WinLibs r7), Release, RTX 3070 Laptop. The base is `main` d146ec1b6 plus other changes I'm testing (#494 rebased, #2863, #290, #2904, #4320 and two unmerged driver changes), with and without the port. Both runs are the same scene, Lana standing in the first village, with `APS5_PROFILE_DRAW=1` and the worker sampler on: | | presents per 10 s | us per draw packet | `readTarget` per draw | lookup per draw | |---|---|---|---|---| | without the port | 91.6 | 114.0 | 10.1 us | 19.8 us | | with the port | 111.4 | 92.2 | 1.7 us | 8.0 us | Before the port, `GuestArena::WindowsMappings::Collect` was 19% of the queue-0 worker's samples: a map lookup and a clean-range insert per 16 KiB page, plus the second walk in `collectable()`. Lana's direct memory is in shared views, and the resident-target refresh walked about 1,200 pages per lookup, because the collect epoch moves at every submission and wait (about 440 submissions and 1,050 waits per second here). With the port, `Collect` no longer shows in the profile, and no AnyPS5 function is above ~1.3%. `agc_shared_write*`, `agc_write_tracking` and `guest_memory` pass with the port on `main` c36fd0a0e, in the same test stack. The full suite was not run with it. <details><summary>The port, on main c36fd0a0e (WindowsMappings.hpp)</summary> ```diff diff --git a/core/libs/prx/libc/include/WindowsMappings.hpp b/core/libs/prx/libc/include/WindowsMappings.hpp index 9d33b9b0b..57e3bd301 100644 --- a/core/libs/prx/libc/include/WindowsMappings.hpp +++ b/core/libs/prx/libc/include/WindowsMappings.hpp @@ -222,6 +222,13 @@ public: *count = 0; const auto end = address + bytes; if (clear && !collectable(address, end)) return false; + std::uintptr_t cleanStart = 0; + std::uintptr_t cleanEnd = 0; + const auto flushClean = [&] { + if (cleanEnd > cleanStart) rememberClean(cleanStart, cleanEnd); + cleanStart = cleanEnd = 0; + }; + auto hint = views.end(); for (auto cursor = address; cursor < end;) { const auto nextClean = cleanRanges.upper_bound(cursor); if (nextClean != cleanRanges.begin()) { @@ -232,16 +239,21 @@ public: } } const auto base = cursor & ~(pageBytes - 1); - const auto found = views.find(base); + const auto found = findView(base, hint); + hint = found; if (found != views.end()) { auto& view = found->second; const auto stop = std::min(std::min(end, base + pageBytes), nextClean == cleanRanges.end() ? end : nextClean->first); - if (view.protection == PAGE_NOACCESS) return false; + if (view.protection == PAGE_NOACCESS) { + flushClean(); + return false; + } const bool pinned = view.page->pins != 0; if (pinned || view.seen != view.page->generation) { const auto needed = (stop - cursor + 4095) / 4096; if (needed > capacity - *count) { for (auto at = cursor; *count < capacity; at += 4096) pages[(*count)++] = reinterpret_cast<void*>(at); + flushClean(); return true; } for (auto at = cursor; at < stop; at += 4096) pages[(*count)++] = reinterpret_cast<void*>(at); @@ -256,10 +268,15 @@ public: other.armed = true; } if (cursor == base && stop == base + pageBytes) view.seen = view.page->generation; - rememberClean(cursor, stop); + if (cleanEnd != cursor) { + flushClean(); + cleanStart = cursor; + } + cleanEnd = stop; } cursor = stop; } else { + flushClean(); const auto memory = query(cursor); if (memory.State != MEM_COMMIT || memory.Type != MEM_PRIVATE) return false; const auto stop = std::min(end, reinterpret_cast<std::uintptr_t>(memory.BaseAddress) + memory.RegionSize); @@ -272,14 +289,24 @@ public: cursor = stop; } } + flushClean(); return true; } private: bool collectable(std::uintptr_t address, std::uintptr_t end) { + auto hint = views.end(); for (auto cursor = address; cursor < end;) { + if (const auto nextClean = cleanRanges.upper_bound(cursor); nextClean != cleanRanges.begin()) { + if (const auto clean = std::prev(nextClean); cursor < clean->second) { + cursor = std::min(end, clean->second); + continue; + } + } const auto base = cursor & ~(pageBytes - 1); - if (const auto found = views.find(base); found != views.end()) { + const auto found = findView(base, hint); + hint = found; + if (found != views.end()) { if (found->second.protection == PAGE_NOACCESS) return false; cursor = std::min(end, base + pageBytes); continue; @@ -313,6 +340,14 @@ private: std::uint64_t offset; std::uint32_t hostWrites; }; + std::map<std::uintptr_t, View>::iterator findView(std::uintptr_t base, std::map<std::uintptr_t, View>::iterator hint) { + if (hint != views.end()) { + if (hint->first == base) return hint; + if (const auto next = std::next(hint); next != views.end() && next->first == base) return next; + } + return views.find(base); + } + void forgetClean(std::uintptr_t start, std::uintptr_t end) { auto it = cleanRanges.lower_bound(start); if (it != cleanRanges.begin() && std::prev(it)->second > start) --it; ``` </details>
adriadam10 commented 2026-10-12 20:11:45 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-12T20:11:45Z.

Review: CHANGES_REQUESTED


Thanks for the measurements. This now conflicts with main in core/libs/prx/libc/include/WindowsMappings.hpp: #3783 rewrote Collect (it walks with cleanRanges.upper_bound and calls rememberClean per stretch), so the three changes have to be re-applied on the new loop rather than merged mechanically.

  • Rebase onto current main and port the iterator hint, the single rememberClean per clean run (flushed before every early return) and the clean-range skip in collectable() onto the new Collect.
  • Repeat the PPSA28416 collect-time measurement on the new base, as @oneandonlydean asked. @yunusshaikh7 posted a port of the same three parts with numbers from another title; compare against it.

We can't build or measure Windows-only code here, so we can't do the rebase for you. Happy to re-review once it's updated.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5495506712 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#pullrequestreview-5495506712). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-12T20:11:45Z. **Review:** CHANGES_REQUESTED --- Thanks for the measurements. This now conflicts with `main` in `core/libs/prx/libc/include/WindowsMappings.hpp`: #3783 rewrote `Collect` (it walks with `cleanRanges.upper_bound` and calls `rememberClean` per stretch), so the three changes have to be re-applied on the new loop rather than merged mechanically. - Rebase onto current `main` and port the iterator hint, the single `rememberClean` per clean run (flushed before every early return) and the clean-range skip in `collectable()` onto the new `Collect`. - Repeat the PPSA28416 collect-time measurement on the new base, as @oneandonlydean asked. @yunusshaikh7 posted a port of the same three parts with numbers from another title; compare against it. We can't build or measure Windows-only code here, so we can't do the rebase for you. Happy to re-review once it's updated.
CnRJay commented 2026-10-13 19:24:34 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by CnRJay on 2026-10-13T19:24:34Z.


Overlaps with #5062 in WindowsMappings.hpp (the in-order view walk and the collectable() fast path). This PR also remembers clean pages once per run in Collect, which #5062 does not touch. Whichever merges second will rebase and drop what the first already covers.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153402817 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#issuecomment-6153402817). Originally posted by [CnRJay](https://github.com/CnRJay) on 2026-10-13T19:24:34Z. --- Overlaps with #5062 in `WindowsMappings.hpp` (the in-order view walk and the `collectable()` fast path). This PR also remembers clean pages once per run in `Collect`, which #5062 does not touch. Whichever merges second will rebase and drop what the first already covers.
Scramblrrrr commented 2026-10-13 19:47:15 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Scramblrrrr on 2026-10-13T19:47:15Z.


Windows cross-test of e5c6bd4a2c900c50c0d07d563f6a8de74e88cafc on our older integration: exact author-preserved one-file port66e97032f4fd375e70d94081da13b9ebda9db53a, https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-write-collect-cross-test . Source/conventions clean.

Restored final6/6 controls pass6.26s: guest_memory, windows_write_watch, shared-write partial collection single/two-pass, write tracking, mocked driver graphics. Windows Release/GCC15.2/RTX5070Ti; native Vulkan required where applicable. Existing failed-collect/write preservation, armed/fresh collection and subpage controls retained. No new fixture for the speed-only transformation. Parent production header with unchanged fixtures also6/6 pass6.91s; not an expected negative for this optimization.

Initial graphics invocation failed its precondition "write-watched arena contained no host exclusion to test"; unchanged restored run passed. Cause is not confirmed and this is not suppressed or counted as a pass. No Linux/macOS/full-suite claim. Starting title cross-test with only libc changed; graphics/Agc/VideoOut remain our verified sparse-run693 cohort, unary shader port remains unstaged. RAM guard has additional bounded working-set trims, same free/private limits, so no clean title FPS A/B claim yet.

AI-assisted: yes (Codex); no title data attached.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6153815028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#issuecomment-6153815028). Originally posted by [Scramblrrrr](https://github.com/Scramblrrrr) on 2026-10-13T19:47:15Z. --- Windows cross-test of e5c6bd4a2c900c50c0d07d563f6a8de74e88cafc on our older integration: exact author-preserved one-file port66e97032f4fd375e70d94081da13b9ebda9db53a, https://github.com/Scramblrrrr/AnyPS5/tree/codex/first-light-write-collect-cross-test . Source/conventions clean. Restored final6/6 controls pass6.26s: guest_memory, windows_write_watch, shared-write partial collection single/two-pass, write tracking, mocked driver graphics. Windows Release/GCC15.2/RTX5070Ti; native Vulkan required where applicable. Existing failed-collect/write preservation, armed/fresh collection and subpage controls retained. No new fixture for the speed-only transformation. Parent production header with unchanged fixtures also6/6 pass6.91s; not an expected negative for this optimization. Initial graphics invocation failed its precondition "write-watched arena contained no host exclusion to test"; unchanged restored run passed. Cause is not confirmed and this is not suppressed or counted as a pass. No Linux/macOS/full-suite claim. Starting title cross-test with only libc changed; graphics/Agc/VideoOut remain our verified sparse-run693 cohort, unary shader port remains unstaged. RAM guard has additional bounded working-set trims, same free/private limits, so no clean title FPS A/B claim yet. AI-assisted: yes (Codex); no title data attached.
adriadam10 commented 2026-10-14 10:33:48 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T10:33:48Z.

Review: CHANGES_REQUESTED


This conflicts with main again in core/libs/prx/libc/include/WindowsMappings.hpp (3 hunks). It needs a re-port, not a mechanical rebase:

  • Collect now has a resident branch (collectResident, watchResident) with its own return false / return true paths. The pending clean run (flushClean) has to be flushed before each of them, as in the other early returns.
  • collectable() was rewritten for resident views (found->second.resident && !watchResident returns false); the cleanRanges skip and the iterator hint must be re-applied on top of that.
  • #5062 touches the same two loops (in-order view walk and the collectable() fast path). Please settle with it which parts remain here (the single rememberClean per clean run is the part #5062 doesn't cover) and drop what it already does.
  • Please repeat the PPSA28416 collect-time measurement on the new base, as already requested above.

Once it is rebased on current main and the Windows job is green, this is ready to re-review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5516580855 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#pullrequestreview-5516580855). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T10:33:48Z. **Review:** CHANGES_REQUESTED --- This conflicts with `main` again in `core/libs/prx/libc/include/WindowsMappings.hpp` (3 hunks). It needs a re-port, not a mechanical rebase: - `Collect` now has a `resident` branch (`collectResident`, `watchResident`) with its own `return false` / `return true` paths. The pending clean run (`flushClean`) has to be flushed before each of them, as in the other early returns. - `collectable()` was rewritten for resident views (`found->second.resident && !watchResident` returns false); the `cleanRanges` skip and the iterator hint must be re-applied on top of that. - #5062 touches the same two loops (in-order view walk and the `collectable()` fast path). Please settle with it which parts remain here (the single `rememberClean` per clean run is the part #5062 doesn't cover) and drop what it already does. - Please repeat the PPSA28416 collect-time measurement on the new base, as already requested above. Once it is rebased on current `main` and the Windows job is green, this is ready to re-review.
adriadam10 commented 2026-10-14 17:35:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T17:35:52Z.

Review: APPROVED


Re-checked on the new head: the pending clean run is flushed before the resident, PAGE_NOACCESS, full-buffer and private-memory returns and at the end of Collect; skip continues leave it pending and the next non-adjacent stretch flushes it. It only covers pages behind the cursor, and nothing inside Collect/collectResident/protectSubpages touches cleanRanges, so the lookups ahead see the same map. No conflicts with main; libc build and ctest are green on Linux (this code is Windows-only). Merging once the Windows build is green.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5522045997 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/3864#pullrequestreview-5522045997). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-14T17:35:52Z. **Review:** APPROVED --- Re-checked on the new head: the pending clean run is flushed before the resident, `PAGE_NOACCESS`, full-buffer and private-memory returns and at the end of `Collect`; skip `continue`s leave it pending and the next non-adjacent stretch flushes it. It only covers pages behind the cursor, and nothing inside `Collect`/`collectResident`/`protectSubpages` touches `cleanRanges`, so the lookups ahead see the same map. No conflicts with main; libc build and ctest are green on Linux (this code is Windows-only). Merging once the Windows build is green.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!3864
No description provided.