systemd-oomd Explained: The Userspace OOM Killer, How It Decides, and How to Tame It
systemd-oomd explained: how it uses PSI and swap use to kill cgroups before the kernel OOM killer, its defaults, how to spot kills, and how to exempt services.
systemd-oomd is a userspace out-of-memory killer that ships with systemd. Instead of waiting for the kernel to run out of memory, it watches memory pressure (via PSI) and swap usage per cgroup, and when a configured limit is exceeded it sends SIGKILL to every process in one chosen cgroup, usually a whole service or a whole desktop app. It needs cgroup v2, and it only acts on units that opt in with ManagedOOMMemoryPressure=kill or ManagedOOMSwap=kill. Fedora (since 34) and Ubuntu Desktop (since 22.04) enable it by default, which is why some people first meet it as "my browser or IDE just vanished".
Checked against the systemd man pages systemd-oomd.service(8), oomd.conf(5), systemd.resource-control(5) and oomctl(1), the systemd source, Fedora's EnableSystemdOomd change and current systemd package, and the Ubuntu 22.04 release notes in November 2026.
Why it exists
The kernel's OOM killer is a last resort. It runs when an allocation can't be satisfied even after reclaim, and by then a machine with swap has often spent minutes thrashing: the desktop freezes, SSH stops responding, and requests time out. The Linux OOM Killer covers how that works and how it picks a victim.
systemd-oomd tries to act earlier, while the system is struggling but still responsive. The man page describes it as a service that "uses cgroups-v2 and pressure stall information (PSI) to monitor and take corrective action before an OOM occurs in the kernel space."
| Kernel OOM killer | systemd-oomd | |
|---|---|---|
| Runs in | Kernel | Userspace daemon (systemd-oomd.service) |
| Triggers on | Allocation failure after reclaim | Sustained memory pressure, or memory plus swap usage above a limit |
| Picks | One process, by oom_score |
One cgroup, among descendants of a monitored unit |
| Kills | That process (or the cgroup if memory.oom.group is set) |
Every process in the chosen cgroup, with SIGKILL |
| Configured by | oom_score_adj, cgroup memory.max |
oomd.conf and ManagedOOM*= unit properties |
| Active by default | Always | Only on distros that enable it, and only for units that opt in |
Requirements
From the man page:
- cgroup v2 only, with the full unified hierarchy. Check with
stat -fc %T /sys/fs/cgroup;cgroup2fsmeans you have it. - PSI support in the kernel, which arrived in Linux 4.20. If
/proc/pressure/memoryexists, you have it. (Linux Pressure Stall Information explains the numbers in that file.) - Memory accounting enabled on the monitored units. The man page recommends
DefaultMemoryAccounting=yesinsystemd-system.conf. - Swap is strongly recommended. Swap-based rules are ignored on a machine with no swap, and without swap, pressure tends to spike too abruptly for the pressure rules to catch it cleanly.
How it decides what to kill
There are two independent triggers. A unit enables each one by setting the property to kill.
Memory pressure (ManagedOOMMemoryPressure=kill). systemd-oomd reads the "full" memory pressure average for the unit's cgroup. If it stays above the limit for longer than the configured duration, it picks a cgroup below that unit, preferring the one with the most reclaim activity, and kills it.
Swap (ManagedOOMSwap=kill). When both memory and swap usage on the whole system are above SwapUsedLimit=, it looks at eligible cgroups using more than 5% of total swap and kills the one using the most. This is normally set on the root slice, -.slice, so everything on the machine is a candidate.
Two details that surprise people:
- The unit that sets
killis not itself a candidate; its descendants are. Setting it onsystem.slicemakes individual services candidates, not the slice. - Only leaf cgroups, or cgroups with
memory.oom.groupset to1, are eligible. In practice that means a whole service, a whole user session scope, or a whole desktop app scope goes at once.
The settings
Unit properties, from systemd.resource-control(5). They apply to slices, scopes, services, sockets, mounts and swaps:
| Property | Values | Default |
|---|---|---|
ManagedOOMMemoryPressure= |
auto, kill |
auto (not monitored) |
ManagedOOMSwap= |
auto, kill |
auto |
ManagedOOMMemoryPressureLimit= |
0% to 100% | 0%, meaning use oomd.conf's default |
ManagedOOMMemoryPressureDurationSec= |
empty or at least 1s (systemd 257+) |
empty, meaning use oomd.conf's default |
ManagedOOMPreference= |
none, avoid, omit |
none |
Daemon-wide defaults, from oomd.conf(5), in /etc/systemd/oomd.conf or drop-ins under /etc/systemd/oomd.conf.d/:
| Option | Upstream default |
|---|---|
SwapUsedLimit= |
90% |
DefaultMemoryPressureLimit= |
60% |
DefaultMemoryPressureDurationSec= |
30s |
Distributions override these. Fedora's original change set ManagedOOMMemoryPressure=kill at 50% on user@.service and ManagedOOMSwap=kill on -.slice. Its current systemd package takes a different approach in the systemd-oomd-defaults subpackage: a 20-second pressure duration, and ManagedOOMMemoryPressure=kill with an 80% limit on system.slice and on user slices, with no swap rule. Ubuntu's 22.04 release notes say only that systemd-oomd is enabled and shipped by default on the Ubuntu Desktop flavour. Don't rely on any of these numbers; read your own machine's config (next section).
Is it running here, and what is it watching?
systemctl status systemd-oomd
# merged oomd.conf with all drop-ins
systemd-analyze cat-config systemd/oomd.conf
# which cgroups it monitors, their pressure and limits
oomctl dump
# what a given slice or service is set to
systemctl show -p ManagedOOMMemoryPressure,ManagedOOMMemoryPressureLimit,ManagedOOMSwap system.slice
oomctl dump is the most useful of these: it lists every monitored cgroup with its current pressure figures and the limit it will be judged against.
How to tell it killed something
systemd-oomd logs every kill to the journal, and the service manager logs one more line on the unit that lost processes:
journalctl -u systemd-oomd --since today
journalctl --since today | grep -E 'systemd-oomd killed|due to memory (pressure|used)'
The daemon's line names the victim cgroup and the reason, along these lines (the exact wording varies by systemd version, so match on "due to memory pressure" or "due to memory used"):
Killed /system.slice/myapp.service due to memory pressure for /system.slice being 84.20% > 80.00% for > 20s with reclaim activity
The unit's own log gets a line like systemd-oomd killed 12 process(es) in this unit. For a service with the default OOMPolicy=stop, the service is then stopped and marked failed with result oom-kill, so systemctl status myapp shows it, and the man page notes that Restart= may then apply.
A key difference from kernel OOM kills: these don't appear in dmesg. If a process died with signal 9 and the kernel log is clean, check the systemd-oomd journal next.
Exempting a service
If one service must never be picked, give it ManagedOOMPreference=:
sudo systemctl edit myapp.service
[Service]
ManagedOOMPreference=omit
avoid means "only if there's no other candidate"; omit means "never". Both work through extended attributes on the cgroup, and the man page notes they're only honoured when the cgroup is owned by root (or, for pressure decisions, owned by the same user as the monitored ancestor). That's fine for system services; it's why these settings on user-level units are ignored when the monitored unit is a system-wide slice. The docs also recommend using them sparingly, since every exemption pushes the kill onto something else.
To change the threshold for one slice instead, override its limit:
sudo systemctl edit system.slice
[Slice]
ManagedOOMMemoryPressureLimit=90%
Turning it off on a server
On a desktop, an early kill of a runaway browser tab beats a frozen machine. On a server, a whole service disappearing because of a pressure spike may be worse than a slow minute, especially if you already run with cgroup memory limits (How Container CPU and Memory Limits Actually Work) and want the kernel to enforce them.
Options, from least to most drastic:
- Opt units out. Set
ManagedOOMMemoryPressure=auto(andManagedOOMSwap=auto) in a drop-in for the slice that haskill, such assystem.sliceor-.slice, thensudo systemctl daemon-reload. systemd-oomd keeps running but has nothing to act on there. - Remove the distro policy. On Fedora, the change page documents removing the
systemd-oomd-defaultspackage followed bysystemctl daemon-reload. On Ubuntu, systemd-oomd is its own package and can be removed with apt. - Stop the daemon. Any unit with a
ManagedOOM*=killsetting gets aWants=dependency onsystemd-oomd.service, so disabling it alone may not keep it stopped. Mask it instead:
sudo systemctl mask --now systemd-oomd.service systemd-oomd.socket
Whichever you choose, the kernel OOM killer still exists. Turning off systemd-oomd means you're back to the kernel deciding at the last moment, so make sure your services have sensible MemoryMax= limits and that you understand how memory overcommit affects when that moment arrives.
If you want to see what it would do before trusting it, the daemon accepts --dry-run (systemd 253+), which logs the kills it would make without performing them.
EasySpawn servers are managed: there's no root access, so oomd.conf and kernel OOM settings are the platform's job, not yours. What you still control is how much memory your app, its database and Claude Code's builds ask for on the server you choose. See how it works or join the waitlist.
Related: The Linux OOM Killer: Why Your Process Was Killed · Linux Pressure Stall Information (PSI): Measuring Resource Contention · Linux Memory Overcommit: Why malloc Never Fails and the OOM Killer Does · What Is systemd? Services, systemctl and journalctl for Beginners
Keep reading
ERR_HTTP2_PROTOCOL_ERROR Explained for Site Owners: What the Browser Saw and How to Find the Cause
ERR_HTTP2_PROTOCOL_ERROR means an HTTP/2 stream was reset or a response broke the rules. The usual causes (aborted responses, bad headers) and how to debug.
Linux Pressure Stall Information (PSI): Measuring Resource Contention
CPU percentage and free memory don't tell you whether your workload is actually being slowed down. Pressure stall information does: the share of time tasks were stalled waiting for CPU, memory or I/O. Reading /proc/pressure, some vs full, per-cgroup pressure, triggers, and using PSI for alerts and OOM handling.