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. Any swap-based actions on systems without swap will be ignored.
48 While systemd-oomd can perform pressure-based actions on a system
49 without swap, the pressure increases will be more abrupt and may
50 require more tuning to get the desired thresholds and behavior.
51
52 Be aware that if you intend to enable monitoring and actions on
53 user.slice, user-$UID.slice, or their ancestor cgroups, it is highly
54 recommended that your programs be managed by the systemd user manager
55 to prevent running too many processes under the same session scope (and
56 thus avoid a situation where memory intensive tasks trigger
57 systemd-oomd to kill everything under the cgroup). If you're using a
58 desktop environment like GNOME, it already spawns many session
59 components with the systemd user manager.
60
62 ManagedOOMSwap= works with the system-wide swap values, so setting it
63 on the root slice -.slice, and allowing all descendant cgroups to be
64 eligible candidates may make the most sense.
65
66 ManagedOOMMemoryPressure= tends to work better on the cgroups below the
67 root slice -.slice. For units which tend to have processes that are
68 less latency sensitive (e.g. system.slice), a higher limit like the
69 default of 60% may be acceptable, as those processes can usually ride
70 out slowdowns caused by lack of memory without serious consequences.
71 However, something like user@$UID.service may prefer a much lower value
72 like 40%.
73
75 systemd(1), systemd-system.conf(5), systemd.resource-control(5),
76 oomd.conf(5), oomctl(1)
77
79 1. "In defence of swap: common misconceptions"
80 https://chrisdown.name/2018/01/02/in-defence-of-swap.html
81
82
83
84systemd 250 SYSTEMD-OOMD.SERVICE(8)