2023-08-30 02:38:59 +02:00
|
|
|
earlyoom (the early out-of-memory daemon)
|
|
|
|
|
|
|
|
The Linux kernel's OOM-killer generally has a bad reputation among
|
|
|
|
Linux users. One may have to sit in front of an unresponsive system,
|
|
|
|
listening to the grinding disk for minutes, and press the reset
|
|
|
|
button to quickly get back to what one was doing after running out of
|
|
|
|
patience.
|
|
|
|
|
|
|
|
earlyoom is a userspace daemon that can be triggered earlier than the
|
|
|
|
kernel's OOM-killer. It checks the amount of available memory and free
|
|
|
|
swap up to 10 times a second (less often if there is a lot of free
|
|
|
|
memory). By default if both are below 10%, it will kill the largest
|
|
|
|
process (highest oom_score). The percentage value is configurable via
|
|
|
|
command line arguments.
|
2022-09-14 08:21:28 +02:00
|
|
|
|
|
|
|
To enable it, put this line in your rc.local after running chmod +x on
|
|
|
|
/etc/rc.d/rc.earlyoom:
|
|
|
|
|
2023-08-30 02:38:59 +02:00
|
|
|
if [ -x /etc/rc.d/rc.earlyoom ]; then
|
2022-09-14 08:21:28 +02:00
|
|
|
/etc/rc.d/rc.earlyoom start
|
|
|
|
fi
|
|
|
|
|
2023-08-30 02:38:59 +02:00
|
|
|
...and to have it exit at shutdown, put this in your rc.local_shutdown:
|
2022-09-14 08:21:28 +02:00
|
|
|
|
2023-08-30 02:38:59 +02:00
|
|
|
if [ -x /etc/rc.d/rc.earlyoom ]; then
|
2022-09-14 08:21:28 +02:00
|
|
|
/etc/rc.d/rc.earlyoom stop
|
|
|
|
fi
|
|
|
|
|
2023-08-30 02:38:59 +02:00
|
|
|
A log file for it is kept at /var/log/earlyoom.log, and earlyoom can
|
|
|
|
be configured by modifying /etc/default/earlyoom.
|