3 ms·
It would be nice to have a signal as a warning to process to reduce it's memory footprint or else OOM will kill it.
by po1nt 4mo ago
It would be nice to have a signal as a warning to process to reduce it's memory footprint or else OOM will kill it.
- masklinn 4mo agoIt’s possible via cgroups, kinda. cgroups v1 has a pretty nice API but it requires root. V2 does not require root but it’s a lot coarser and not as simple or reliable: https://unix.stackexchange.com/questions/753929/receive-a-memory-pressure-event-with-cgroups-v2-when-no-memory-limit-is-set https://unix.stackexchange.com/questions/753929/receive-a-me...
- Joker_vD 4mo agoYou still need some way to make the kernel to send those signals to the processes of your choosing. If the kernel decides to send SIGLOWMEM to xlock instead of firefox, the xlock will get killed because it really doesn't have any memory it can give up.
- masklinn 4mo agoSIGLOWMEM, if it existed, would have no reason to default to anything other than IGN. It would also logically be sent to “every” process on the machine, with the subsystem probably having a heuristic to skip processes which were already signaled and have not had significant memory increases since. The goal of an early warning is to cooperatively release memory (and maybe abort memory intensive computations), the kernel already kills processes “at random”, it does not need a second way to do that.
- NekkoDroid 4mo agohttps://systemd.io/MEMORY_PRESSURE/ https://systemd.io/MEMORY_PRESSURE/