Linux 5.15 Adds New Syscall To More Quickly Free Memory Of Dying Processes

Written by Michael Larabel in Linux Kernel on 6 September 2021 at 07:23 PM EDT. 11 Comments
LINUX KERNEL
To help out memory pressure / out-of-memory killing solutions like systemd-oomd or Android's LMKD, Linux 5.15 is introducing the "process_mrelease" system call to more quickly free the memory of dying processes.

Earlier this summer I wrote about a proposed "process_reap" system call for more quickly reclaiming memory when under pressure. It's that work that evolved into "process_mrelease" and this new system call is now ready to go for Linux 5.15.

The aim in that using this system call can allow for reclaiming memory of a dying process quickly and more predictably than the status quo.


Linux -- particularly Linux on the desktop -- traditionally hasn't coped too well when under memory pressure but there has been steady progress in recent years with systemd-oomd, various kernel innovations, and now process_mrelease being the latest work in this area.


The patch merged to Linux 5.15 by way of Andrew Morton's patch series goes on to explain this process_mrelease system call:
For such system component it's important to be able to free memory quickly and efficiently. Unfortunately the time process takes to free up its memory after receiving a SIGKILL might vary based on the state of the process (uninterruptible sleep), size and OPP level of the core the process is running. A mechanism to free resources of the target process in a more predictable way would improve system's ability to control its memory pressure.

Introduce process_mrelease system call that releases memory of a dying process from the context of the caller. This way the memory is freed in a more controllable way with CPU affinity and priority of the caller. The workload of freeing the memory will also be charged to the caller. The operation is allowed only on a dying process.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week