1SYSTEMD-OOMD.SERVICE(8) systemd-oomd.service SYSTEMD-OOMD.SERVICE(8)
2
3
4
6 systemd-oomd.service, systemd-oomd - A userspace out-of-memory (OOM)
7 killer
8
10 systemd-oomd.service
11
12 /usr/lib/systemd/systemd-oomd
13
15 systemd-oomd is a system service that uses cgroups-v2 and pressure
16 stall information (PSI) to monitor and take action on processes before
17 an OOM occurs in kernel space.
18
19 You can enable monitoring and actions on units by setting
20 ManagedOOMSwap= and/or ManagedOOMMemoryPressure= to the appropriate
21 value. systemd-oomd will periodically poll enabled units' cgroup data
22 to detect when corrective action needs to occur. When an action needs
23 to happen, it will only be performed on the descendant cgroups of the
24 enabled units. More precisely, only cgroups with memory.oom.group set
25 to 1 and leaf cgroup nodes are eligible candidates. Action will be
26 taken recursively on all of the processes under the chosen candidate.
27
28 See oomd.conf(5) for more information about the configuration of this
29 service.
30
32 The system must be running systemd with a full unified cgroup hierarchy
33 for the expected cgroups-v2 features. Furthermore, memory accounting
34 must be turned on for all units monitored by systemd-oomd. The easiest
35 way to turn on memory accounting is by ensuring the value for
36 DefaultMemoryAccounting= is set to true in systemd-system.conf(5).
37
38 You will need a kernel compiled with PSI support. This is available in
39 Linux 4.20 and above.
40
41 It is highly recommended for the system to have swap enabled for
42 systemd-oomd to function optimally. With swap enabled, the system
43 spends enough time swapping pages to let systemd-oomd react. Without
44 swap, the system enters a livelocked state much more quickly and may
45 prevent systemd-oomd from responding in a reasonable amount of time.
46 See "In defence of swap: common misconceptions"[1] for more details on
47 swap.
48
49 Be aware that if you intend to enable monitoring and actions on
50 user.slice, user-$UID.slice, or their ancestor cgroups, it is highly
51 recommended that your programs be managed by the systemd user manager
52 to prevent running too many processes under the same session scope (and
53 thus avoid a situation where memory intensive tasks trigger
54 systemd-oomd to kill everything under the cgroup). If you're using a
55 desktop environment like GNOME, it already spawns many session
56 components with the systemd user manager.
57
59 ManagedOOMSwap= works with the system-wide swap values, so setting it
60 on the root slice -.slice, and allowing all descendant cgroups to be
61 eligible candidates may make the most sense.
62
63 ManagedOOMMemoryPressure= tends to work better on the cgroups below the
64 root slice -.slice. For units which tend to have processes that are
65 less latency sensitive (e.g. system.slice), a higher limit like the
66 default of 60% may be acceptable, as those processes can usually ride
67 out slowdowns caused by lack of memory without serious consequences.
68 However, something like user@$UID.service may prefer a much lower value
69 like 40%.
70
72 systemd(1), systemd-system.conf(5), systemd.resource-control(5),
73 oomd.conf(5), oomctl(1)
74
76 1. "In defence of swap: common misconceptions"
77 https://chrisdown.name/2018/01/02/in-defence-of-swap.html
78
79
80
81systemd 248 SYSTEMD-OOMD.SERVICE(8)