Consider installing systemd-oomd by default

Theoretically, having something like this should make it so that users don’t lose more unsaved work than is absolutely necessary to avoid a fully system crash. However, in practice systemd-oomd can be a source of trouble. Most notably, entire related process groups are killed all at once, rather than just individual processes. With the kernel OOM killer, an individual browser tab can be terminated without taking the entire browser out. systemd-oomd on the other hand will (or at least used to) terminate the whole browser. It’s also rather aggressive about when it kills applications - this resulted in some significant problems when Ubuntu chose to enable it by default in Ubuntu 22.04.

I’m not entirely sure what a good solution here is, but one novel thought is to potentially enable the Magic SysRq key for manual OOM killer triggers. See Linux Magic System Request Key Hacks — The Linux Kernel documentation - if the proper setting is enabled, one can type Alt+SysRq+F to make the kernel’s OOM killer terminate whatever process it believes is the most “dangerous” to the system at the moment from a memory pressure standpoint. This feature can also be triggered in software, so it might even be possible to make a custom app that warns the user when memory is getting dangerously full and provides them a “quick fix” button (with sufficient warnings about data loss).

1 Like