Files
AnyPS5/docs/dev/debt/changes/flexible-memory-shared-backing-libkernel.md
JJenkx 6244c2ed82 perf(libkernel): back flexible memory with a memfd on Linux (#23613)
* perf(libkernel): back flexible memory with a memfd on Linux
* docs(debt): describe the flexible memory backing on Linux
* fix(libkernel): keep flexible memory anonymous and host-imported when its memfd path fails
* fix(libkernel): reject empty flexible backing queries and keep remainders when a hole punch fails
* docs(debt): shorten the flexible memory backing entry and note a failed hole punch
* fix(agc): discard a failed dma-buf import before its host-pointer retry
2026-11-21 12:20:33 +13:00

901 B

libkernel

add Functional

  • On Linux, each flexible memory map is its own sealed memfd, mapped shared from the file offset equal to its address modulo 2 MiB and sized to a multiple of 64 MiB, so GPU imports take it through udmabuf like direct memory instead of a host-pointer buffer object. It is marked MADV_HUGEPAGE, since shared memory gets huge pages only on request where shmem_enabled is advise. Unmapping part of a map punches that part out of the file; a live import keeps the old pages until released, and a failed punch leaves them until the file closes. If creating, sizing or mapping the memfd fails (for example at the descriptor limit), the map stays anonymous, as before. Plain anonymous mmap memory still has no shared backing.