Linux: sceKernelGetModuleInfoForUnwind and sceSysmoduleGetModuleInfoForUnwind scan /proc/self/maps on every call #3235
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 GustavoGamarra95 on 2026-10-11T02:47:41Z.
On Linux,
sceKernelGetModuleInfoForUnwind(Module.cpp) andsceSysmoduleGetModuleInfoForUnwind(libSceSysmodule/Export.cpp) open/proc/self/mapsand scan it line by line withsscanfon every call.Unity IL2CPP titles call them on each stack walk. God of War Sons of Sparta (PPSA28997) has about 900 mappings. On its intro and title screens, 16 of 19
eu-stacksamples of the main thread were inside that scan, and the title ran at about 10 FPS (Arch Linux, Ryzen 5 7535HS, RTX 3050 Laptop).The kernel can answer the same question for one address with the
PROCMAP_QUERYioctl (Linux 6.11), whichGuestMemory.cppalready uses. With both functions asking it on one descriptor opened once, and the line scan kept for older kernels andAPS5_NO_PROCMAP_QUERY, the same screens run at 59.5 FPS (counted from MangoHud frame timestamps over 80 s).A tested implementation is on GustavoGamarra95:perf/unwind-info-procmap-query, rebased on
maind31b57a4. It has three commits: libkernel, libSceSysmodule (which loses its copy of the scan) and a new test forsceSysmoduleGetModuleInfoForUnwind, run with and withoutAPS5_NO_PROCMAP_QUERY. It was opened as #3227 and closed by the PR intake gate. Anyone is welcome to carry it.Imported from boykopovar/AnyPS5. Originally posted by GustavoGamarra95 on 2026-10-11T10:43:31Z.
Fixed by #3227, merged into
main(0c63c838). Thanks @oneandonlydean for reopening it and @adriadam10 for the review.