perf(libc): skip the known occupied guest arena prefix #7938
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/7938"
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 boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T15:11:45Z.
What
Repeated first-fit guest-arena allocations can rescan the same occupied ranges. Cache the contiguous prefixes already proven occupied from the arena base and from the default-allocation start. Nonempty searches use the cache appropriate to their hint. Releases lower both cached bounds before changing the address map. The existing arena mutex protects both caches.
This rebase preserves current main's default allocation placement, explicit lower hints, alignment and wrap behavior. It adds a cross-range regression alongside the existing 8,192-allocation/partial-release/wrap regression and the independent 4,096-operation page model.
Tested
October 23 rebase qualification: rebased as
d1e04a23494cd064f77633711d396633ef90b1c3onto upstream11e8ad293422aad5e30e6c8f5c85048d4dc56649. The controlf4a99f4fdcb2d8c8770553388a7cdec0e54bea74uses that exact main production code plus the sameGuestMemory.cpptest fixtures as the change. Both coherent Releaselibsbuilds pass. Pinned Linux validation bundle. On each arm,guest_memory,guest_mmap_fixed_anonymousandMemoryPoolTesteach pass three consecutive runs (9 executions per arm). The tests cover default/lower-hint allocation, cross-range cache invalidation, partial release, wrap and the independent page model. Conventions and whitespace checks pass. A fresh read-only merge preview against maindcd7e3a61e8a361be622c34ca0f907c263331b87is clean; this is not a claim that those tests were rerun on that newer merge.Historical title-performance evidence: all timings, traces and summary lines below retain their original pins. They do not measure the October 23 rebase. Fresh current-base Lodoss warmups are staged after the CPU qualification; the scenes must be reviewed before collecting or claiming a new gain.
guest_memory,guest_mmap_fixed_anonymous,MemoryPoolTest. They also pass after rebasing this one-commit change onto00d7e611efc97d3d1a1c80e79115a1a1955b2267;libsbuilds, conventions and whitespace checks pass. Windows/macOS execution was not tested locally.00d7e611efc97d3d1a1c80e79115a1a1955b2267against this change7bc3826c81065e6292f2ced6a8b7affe76b41f47,APS5_TRACE_SECONDS=200:30, no other trace/profile switches, measured stdout attached to the terminal. Both processes exit normally and restore the temporary kernel setting. Screenshots before and after capture are retained for visual review.The earlier AB/BA captures used main
bcdee66d109008334b07c0ff73a27e845708675fand candidate1fda13dc754a5f73062e836942f3be76227bc064, before subsequent upstream AGC merges. Their combined observed FPS difference was +8.21%; that result is historical and is not substituted for the October 19 comparison. Earlier candidate p99 was worse in both pairs (64.381 vs 56.551 ms; 60.372 vs 59.335 ms), despite improved median/p90. All individual distributions remain in the evidence. A few timed windows do not establish statistical significance or a gain across titles.Historical October 19 official summary lines, main then change:
The current rebase resolves the
GuestArena.cppconflict by retaining upstream default-placement and lower-hint behavior and using separate prefix bounds for those search regions. Fresh Windows qualification and new Lodoss scene checks are requested on the pinned rebase; they are not included in the retained historical measurements.Windows CPU qualification (2026-10-23): Windows-worker fresh independent full-library/memory builds on
d1e04a2349and main fixturef4a99f4fdc(production base11e8ad2934) pass the same three tests three times per arm: 18/18 executions, no skips. All six raw ctest logs were reviewed by Codex. Windows 11 22621 / Ryzen 9 5950X / WinLibs GCC 15.2.0 UCRT r7 / Ninja Release; conventions and whitespace pass. The raw summaries'basefield is the movingorigin/main, not the tested baseline; both commits have parent11e8ad2934. Pinned report and retained Windows logs. CPU correctness evidence only; no new title/FPS result.Current rebase qualification (2026-10-28)
Refreshed onto
main2227f1366188cda5699dd20e2e756a18006a5d4bas5e59022182b326917f8026302abdc4e5ee35584e. Production and test topic additions/removals are preserved exactly; the test-call conflict retains main’s resident-mapping bookkeeping test and all three arena first-fit regressions. Main fixtures and submodule pointers are retained.Linux Release: libc/libkernel and guest_memory_tests build; guest_memory passes three consecutive runs with zero skips. Conventions and whitespace pass. This is focused CPU rebase qualification. Existing same-scene/native performance evidence retains its historical pins; no refreshed performance improvement is claimed. AI-assisted: yes.
Source-preservation proofs, builds, controls, logs and JUnit, SHA-256
17fa7113ae7732ef2704bcb76e11ef6528c6fd74684037c27fb1a5b516ce9988. Existing historical platform and title measurements retain their original source pins.Additional main-conflict refresh — 2026-10-30
Refreshed to
a87ce798925b83382f1cfc5e8e82feb967002bb9against tested mainde2ba4cecb30ffb1c04d7e7dd693b03eace96b1b. Original authored changes, authorship and main gitlinks are preserved; publication used an exact old-head lease.The allocator conflict retains main's
__EMSCRIPTEN__dirty-range tracking and both occupied-prefix rewinds. Existing alignment, partial-free/wrap, first-fit/model and lower-hint regressions are preserved. Fresh libc/libkernel and test builds passguest_memory,guest_mmap_fixed_anonymousandMemoryPoolTestthree times: nine executions, zero skips. The WebAssembly branch was preserved from source and was not executed. Earlier native-title performance and Windows results retain their original pins.Conventions, whitespace and source preservation checks pass. Latest main
42d009f5f37c8f388b01fbfe38d2e704c792c46fhas a clean merge preview; that preview tree was not executed. This refresh adds Linux CPU qualification; it adds no Windows/macOS, SDK, GPU, title or performance execution.Immutable source, build and test receipts, SHA-256
098ecc93f56b576370b295af428157ef9e4b8ae2dabfdcb9816869be02270985(download verified). AI-assisted: yes (Codex).Packaging note: the archive's nested
result.jsonretains an earlier packaging digest. The download SHA-256 above is authoritative; all 81 source/test proof files were checked unchanged, including the raw JUnit counts and published-head patches.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Slave Zero X startup observations — 2026-10-31
Successful startup repeats show a lower loading marker and less native CPU time, but one candidate startup crashed, and attribution is unresolved. These results do not establish stable operation or a gameplay FPS gain.
Pinned main
60bdb061356db736928eee431cd8bd4c9ba68036, controlc0853b4aa591be9b6748d23ab2e32422243a3025, candidateb7bb866126b37793377db290635633c6afc253bc(this PR's unchanged public topica87ce798925b83382f1cfc5e8e82feb967002bb9applied to that main). Both local commits are clean and have byte-identical GuestMemory fixtures; the sole production difference is GuestArena.cpp. Both rebuilds pass guest_memory, guest_mmap_fixed_anonymous and guest_mmap_executable, 3/3 groups per arm.Same machine, PPSA13899 v01.000.006, same inactive ordinary-save seed, same guest executable hash, no input, shader caches disabled (not an OS page-cache cold run). Whole arms serialize through the host FIFO, with an ordinary close scheduled at 180 seconds; early failures are retained.
Loading stringsmarker36In A3/B3, native-TTY-to-playerprefs observed time was60.439s vs45.499s. Sampled startup native CPU time was67.75 vs48.95CPU-seconds (windows2.505–60.639s and2.505–45.598s respectively). External host busy time differed: estimated3.645 vs2.232 other core equivalents. Thus the25.0% lower game-reported marker is an observed successful-run result, not an isolated causal estimate. CPU accounting includes all native threads; host-minus-native is an aggregate estimate.
The90:30 traces and100s captures show the same autosave screen, approximately60FPS on both. These are inactive composite captures, without independent active X11 verification. A1/B1 used60:30 and can straddle startup; their traces are excluded from settled-scene comparison.
All six unmodified run receipts are retained: A1,B1,A2,A3,B3 exit0; B2 exits139 at16.1s before the trace, with a host-libc read fault at0x2412a0000. A subsequent debugger run exits normally, but its final diagnostic JSON write fails; that run is excluded from performance. No crash fix is claimed. Every run restores udmabuf64, leaves no private native process, and preserves the original inputs.
Source patches, exact pins, CPU tests, all native receipts including the failure, host/native CPU samples, official traces/digests and reviewed captures. SHA-256
6bb4b7420891b48d2529f6e48162d515dfa6a51e4264f79596d135a7d9b7e2e8(download verified). No game binaries, raw memory or perf.data. AI-assisted: yes (Codex).Official same-scene summary lines (A3/B3)
Imported from boykopovar/AnyPS5. Originally posted by JJenkx on 2026-10-19T20:51:21Z.
Additional integration evidence: the occupied-prefix change still showed an observed benefit with #7849, #6951 and #6321 present.
This is an incremental composition check, not a fresh unmodified-main comparison or a new dependency. Baseline
0b74bcd8f63465dc7630247d3899531e21e29b44is upstream283cde8987plus those three peers; candidatead7eb35dbc4d32aabd538a9b3c57edd8260530e4adds only this PR, cherry-picked locally. Latest fetched main9127ea36d2differs from that upstream base only by the syntax-check tooling in #7435. None of the peer code was added to this PR branch.Same Ryzen 9 7950X / RX 6650 XT, RADV Mesa 26.2.4-arch1.1; PPSA05347 stationary opening forest, centered character, HP100, tutorial visible. Same scripted inputs, initially byte-identical warm shader/Mesa cache clones, pipelined draws and DMA enabled,
APS5_TRACE_SECONDS=200:30. Screenshots at190/240 seconds remain visually consistent. One ordered baseline-then-change pair; different first-present indices are preserved in the summaries. This does not establish statistical significance or gains across titles.Observed FPS difference: +11.86%. Both traces report no dropped events. Both native processes exited0, disappeared, and restored the kernel setting to64MiB.
libsandguest_memory_testsbuild; the same19 focused tests pass on baseline and candidate with Vulkan required, shader cache disabled, core validation enabled, no skips/missing layer/VUIDs. Candidate also passesMemoryPoolTestandguest_mmap_fixed_anonymous; conventions/whitespace checks pass. Windows/macOS execution was not tested.Official summary lines, peer baseline then addition of this PR:
Evidence bundle includes both full traces, summaries, protocols, screenshots, focused logs, source patches and diagnostic CPU reports. Downloaded back and SHA-256 verified:
70d7d42b7f056675958af17970a64cc9ba4d765c32a19fe472b5bbefdd580e9e.The separate15s CPU samples start at232s, after the official measurement interval. Tree-iteration self samples fell from24.45% to16.44% of sampled user CPU; these are relative shares, not absolute timing. Remaining registry snapshot work is visible through real map/unmap callbacks, which is the next profiling lead.