Best OOM manager for TW?

What is the recommended way to handle OOM on Tumbleweed? I recently noticed that my installation of TW doesn’t have any OOM manager beside what the kernel provides. So I tried this simple test tail /dev/zero and watched the memory in the system monitor. When both the memory and swap filled up, the system froze. I decided to wait a bit longer and after a minute or so the kernel finally killed that rogue tail process. This made me wonder why isn’t there any OOM manager installed?

I searched for a way to install systemd-oomd, which appears to be a part of the systemd-experimental package. Upon the installation I enabled the service and rebooted just in case. I reran the tail test, but it seemed like systemd-oomd didn’t work because the system froze again. I checked the journalctl log which indicated that it was the kernel oom killer that resolved the oom, not the systemd-oomd.

So I uninstalled systemd-oomd and installed earlyoom instead. This time it worked perfectly and killed the test tail process just when it was about to consume all the swap. But the system remained responsive at all times.

I couldn’t find any recommendations for the OOM manager for openSUSE. This looks like an oversight.

1 Like

@alexzak Hi and welcome to the Forum :smile:
AFAIK earlyoom is the way… Perhaps a peruse of the old thread https://forums.opensuse.org/t/oom-killer-back-active-after-update/145104/

Just a note, make any sysctl changes as conf files down in /etc/sysctl.d/ directory, openSUSE Tumbleweed also moved to /usr/etc so some configs that use to reside in /etc have moved, but can be overridden in /etc/some.d/ directory.

1 Like

Thanks for the advice about the sysctl parameters.

I am wondering. On infamous host erlangen tail /dev/zero gets removed smoothly:

erlangen:~ # journalctl -b -g oom
Nov 25 09:14:16 erlangen kernel: InputThread invoked oom-killer: gfp_mask=0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), order=0, oom_score_adj=0
Nov 25 09:14:16 erlangen kernel:  oom_kill_process+0xf9/0x190
Nov 25 09:14:16 erlangen kernel: [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
Nov 25 09:14:16 erlangen kernel: oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-0.slice,task=tail,pid=2481,uid=0
Nov 25 09:14:16 erlangen kernel: Out of memory: Killed process 2481 (tail) total-vm:21236120kB, anon-rss:21232896kB, file-rss:256kB, shmem-rss:0kB, UID:0 pgtables:41596kB oom_score_adj:0
erlangen:~ # 

No freeze occurs.

Agreed.

Here also using earlyoom and the good thing is that it is available as package from the Main Repository (OSS).

> sudo zypper in earlyoom
> sudo systemctl start earlyoom
> sudo systemctl enable earlyoom
> Created symlink /etc/systemd/system/multi-user.target.wants/earlyoom.service → /usr/lib/systemd/system/earlyoom.service.
2 Likes

If you are going to use earlyoom systemd service, make sure to check out the manpage. The -p switch needs some tweaks.

3 Likes