Improving Ubuntu Desktop stability under memory pressure

As part of Ubuntu 26.10, we are changing a long standing default that defines how the desktop behaves when the system runs very low on memory.

The issue

When the system runs out of memory, it has to choose processes to terminate.

It led to issues such as Bug 2089800 - Ubuntu desktop is unstable under memory pressure due to undesireable OOMScoreAdjust values. In some cases, critical parts of the desktop session, like GNOME Shell or D-Bus, could be selected before the application that actually consumes most of the memory. Losing one of those services can make the whole graphical session unusable or simply terminated.

What changed?

The new policy gives critical desktop services more protection:

  • Critical desktop services now use a lower OOM score, making them less likely to be selected by the kernel OOM killer.
  • Applications and background services keep a higher default score, so they remain more likely to be terminated first.
  • The automatic systemd-oomd memory-pressure kill for the whole user session is disabled. systemd-oomd does not use the same OOM priority scores as the kernel. It could then terminate a critical desktop service based on memory pressure alone.

Of course, this does not prevent applications from being terminated when the system runs out of memory, and it does not make Ubuntu immune to OOM conditions.

The goal is simply to preserve the desktop session where possible, and terminate applications before the services needed to keep that session running.

This is a first step. In future cycles, we will make these policies more granular across desktop services and applications.

Please help us test

The change is part of ubuntu-settings and is available in the current development release, Stonking Singray, to be released in a month.

Please test it with memory-intensive workloads, especially on systems with limited RAM or swap, and report any unexpected terminations or session failures to Launchpad.

11 Likes

What a relief.

I have been using EarlyOOM to kill my annoying and stale browser tabs.

https://dev.to/prasadkjose/keeping-linux-responsive-taming-the-oom-killer-with-earlyoom-14ef

1 Like