Debian Codegraph @

upstream/debian-unstable/man5/systemd.resource-control.5

raw
1 '\" t
2 .TH "SYSTEMD\&.RESOURCE\-CONTROL" "5" "" "systemd 261~rc3" "systemd.resource-control"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 systemd.resource-control \- Resource control unit settings
24 .SH "SYNOPSIS"
25 .PP
26 \fIslice\fR\&.slice,
27 \fIscope\fR\&.scope,
28 \fIservice\fR\&.service,
29 \fIsocket\fR\&.socket,
30 \fImount\fR\&.mount,
31 \fIswap\fR\&.swap
32 .SH "DESCRIPTION"
33 .PP
34 Unit configuration files for services, slices, scopes, sockets, mount points, and swap devices share a subset of configuration options for resource control of spawned processes\&. Internally, this relies on the Linux Control Groups (cgroups) kernel concept for organizing processes in a hierarchical tree of named groups for the purpose of resource management\&.
35 .PP
36 This man page lists the configuration options shared by those six unit types\&. See
37 \fBsystemd.unit\fR(5)
38 for the common options of all unit configuration files, and
39 \fBsystemd.slice\fR(5),
40 \fBsystemd.scope\fR(5),
41 \fBsystemd.service\fR(5),
42 \fBsystemd.socket\fR(5),
43 \fBsystemd.mount\fR(5), and
44 \fBsystemd.swap\fR(5)
45 for more information on the specific unit configuration files\&. The resource control configuration options are configured in the [Slice], [Scope], [Service], [Socket], [Mount], or [Swap] sections, depending on the unit type\&.
46 .PP
47 In addition, options which control resources available to programs
48 \fIexecuted\fR
49 by systemd are listed in
50 \fBsystemd.exec\fR(5)\&. Those options complement options listed here\&.
51 .SS "Enabling and disabling controllers"
52 .PP
53 Controllers in the cgroup hierarchy are hierarchical, and resource control is realized by distributing resource assignments between siblings in branches of the cgroup hierarchy\&. There is no need to explicitly
54 \fIenable\fR
55 a cgroup controller for a unit\&.
56 \fBsystemd\fR
57 will instruct the kernel to enable a controller for a given unit when this unit has configuration for a given controller\&. For example, when
58 \fICPUWeight=\fR
59 is set, the
60 \fBcpu\fR
61 controller will be enabled, and when
62 \fITasksMax=\fR
63 are set, the
64 \fBpids\fR
65 controller will be enabled\&. In addition, various controllers may be also be enabled explicitly via the
66 \fIMemoryAccounting=\fR/\fITasksAccounting=\fR/\fIIOAccounting=\fR
67 settings\&. Because of how the cgroup hierarchy works, controllers will be automatically enabled for all parent units and for any sibling units starting with the lowest level at which a controller is enabled\&. Units for which a controller is enabled may be subject to resource control even if they do not have any explicit configuration\&.
68 .PP
69 Setting
70 \fIDelegate=\fR
71 enables any delegated controllers for that unit (see below)\&. The delegatee may then enable controllers for its children as appropriate\&. In particular, if the delegatee is
72 \fBsystemd\fR
73 (in the
74 user@\&.service
75 unit), it will repeat the same logic as the system instance and enable controllers for user units which have resource limits configured, and their siblings and parents and parents\*(Aq siblings\&.
76 .PP
77 Controllers may be
78 \fIdisabled\fR
79 for parts of the cgroup hierarchy with
80 \fIDisableControllers=\fR
81 (see below)\&.
82 .PP
83 \fBExample\ \&1.\ \&Enabling and disabling controllers\fR
84 .sp
85 .if n \{\
86 .RS 4
87 .\}
88 .nf
89 \-\&.slice
90 / \e
91 /\-\-\-\-\-/ \e\-\-\-\-\-\-\-\-\-\-\-\-\-\-\e
92 / \e
93 system\&.slice user\&.slice
94 / \e / \e
95 / \e / \e
96 / \e user@42\&.service user@1000\&.service
97 / \e Delegate= Delegate=yes
98 a\&.service b\&.slice / \e
99 CPUWeight=20 DisableControllers=cpu / \e
100 / \e app\&.slice session\&.slice
101 / \e CPUWeight=100 CPUWeight=100
102 / \e
103 b1\&.service b2\&.service
104 CPUWeight=1000
105 .fi
106 .if n \{\
107 .RE
108 .\}
109 .PP
110 In this hierarchy, the
111 \fBcpu\fR
112 controller is enabled for all units shown except
113 b1\&.service
114 and
115 b2\&.service\&. Because there is no explicit configuration for
116 system\&.slice
117 and
118 user\&.slice, CPU resources will be split equally between them\&. Similarly, resources are allocated equally between children of
119 user\&.slice
120 and between the child slices beneath
121 user@1000\&.service\&. Assuming that there is no further configuration of resources or delegation below slices
122 app\&.slice
123 or
124 session\&.slice, the
125 \fBcpu\fR
126 controller would not be enabled for units in those slices and CPU resources would be further allocated using other mechanisms, e\&.g\&. based on nice levels\&. The manager for user 42 has delegation enabled without any controllers, i\&.e\&. it can manipulate its subtree of the cgroup hierarchy, but without resource control\&.
127 .PP
128 In the slice
129 system\&.slice, CPU resources are split 1:6 for service
130 a\&.service, and 5:6 for slice
131 b\&.slice, because slice
132 b\&.slice
133 gets the default value of 100 for
134 cpu\&.weight
135 when
136 \fICPUWeight=\fR
137 is not set\&.
138 .PP
139 \fICPUWeight=\fR
140 setting in service
141 b2\&.service
142 is neutralized by
143 \fIDisableControllers=\fR
144 in slice
145 b\&.slice, so the
146 \fBcpu\fR
147 controller would not be enabled for services
148 b1\&.service
149 and
150 b2\&.service, and CPU resources would be further allocated using other mechanisms, e\&.g\&. based on nice levels\&.
151 .SS "Setting resource controls for a group of related units"
152 .PP
153 As described in
154 \fBsystemd.unit\fR(5), the settings listed here may be set through the main file of a unit and drop\-in snippets in
155 *\&.d/
156 directories\&. The list of directories searched for drop\-ins includes names formed by repeatedly truncating the unit name after all dashes\&. This is particularly convenient to set resource limits for a group of units with similar names\&.
157 .PP
158 For example, every user gets their own slice
159 user\-\fInnn\fR\&.slice\&. Drop\-ins with local configuration that affect user 1000 may be placed in
160 /etc/systemd/system/user\-1000\&.slice,
161 /etc/systemd/system/user\-1000\&.slice\&.d/*\&.conf, but also
162 /etc/systemd/system/user\-\&.slice\&.d/*\&.conf\&. This last directory applies to all user slices\&.
163 .SS ""
164 .PP
165 See the
166 \m[blue]\fBNew Control Group Interfaces\fR\m[]\&\s-2\u[1]\d\s+2
167 for an introduction on how to make use of resource control APIs from programs\&.
168 .SH "IMPLICIT DEPENDENCIES"
169 .PP
170 The following dependencies are implicitly added:
171 .sp
172 .RS 4
173 .ie n \{\
174 \h'-04'\(bu\h'+03'\c
175 .\}
176 .el \{\
177 .sp -1
178 .IP \(bu 2.3
179 .\}
180 Units with the
181 \fISlice=\fR
182 setting set automatically acquire
183 \fIRequires=\fR
184 and
185 \fIAfter=\fR
186 dependencies on the specified slice unit\&.
187 .RE
188 .SH "OPTIONS"
189 .PP
190 Units of the types listed above can have settings for resource control configuration:
191 .SS "CPU Control"
192 .PP
193 \fICPUWeight=\fR\fI\fIweight\fR\fR, \fIStartupCPUWeight=\fR\fI\fIweight\fR\fR
194 .RS 4
195 These settings control the
196 \fBcpu\fR
197 controller in the unified hierarchy\&.
198 .sp
199 These options accept an integer value or the special string "idle":
200 .sp
201 .RS 4
202 .ie n \{\
203 \h'-04'\(bu\h'+03'\c
204 .\}
205 .el \{\
206 .sp -1
207 .IP \(bu 2.3
208 .\}
209 If set to an integer value, assign the specified CPU time weight to the processes executed, if the unified control group hierarchy is used on the system\&. These options control the
210 "cpu\&.weight"
211 control group attribute\&. The allowed range is 1 to 10000\&. Defaults to unset, but the kernel default is 100\&. For details about this control group attribute, see
212 \m[blue]\fBControl Groups v2\fR\m[]\&\s-2\u[2]\d\s+2
213 and
214 \m[blue]\fBCFS Scheduler\fR\m[]\&\s-2\u[3]\d\s+2\&. The available CPU time is split up among all units within one slice relative to their CPU time weight\&. A higher weight means more CPU time, a lower weight means less\&.
215 .RE
216 .sp
217 .RS 4
218 .ie n \{\
219 \h'-04'\(bu\h'+03'\c
220 .\}
221 .el \{\
222 .sp -1
223 .IP \(bu 2.3
224 .\}
225 If set to the special string "idle", mark the cgroup for "idle scheduling", which means that it will get CPU resources only when there are no processes not marked in this way to execute in this cgroup or its siblings\&. This setting corresponds to the
226 "cpu\&.idle"
227 cgroup attribute\&.
228 .sp
229 Note that this value only has an effect on cgroup\-v2, for cgroup\-v1 it is equivalent to the minimum weight\&.
230 .RE
231 .sp
232 While
233 \fIStartupCPUWeight=\fR
234 applies to the startup and shutdown phases of the system,
235 \fICPUWeight=\fR
236 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
237 \fIStartupCPUWeight=\fR
238 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
239 .sp
240 In addition to the resource allocation performed by the
241 \fBcpu\fR
242 controller, the kernel may automatically divide resources based on session\-id grouping, see "The autogroup feature" in
243 \fBsched\fR(7)\&. The effect of this feature is similar to the
244 \fBcpu\fR
245 controller with no explicit configuration, so users should be careful to not mistake one for the other\&.
246 .sp
247 Added in version 232\&.
248 .RE
249 .PP
250 \fICPUQuota=\fR
251 .RS 4
252 This setting controls the
253 \fBcpu\fR
254 controller in the unified hierarchy\&.
255 .sp
256 Assign the specified CPU time quota to the processes executed\&. Takes a percentage value, suffixed with "%"\&. The percentage specifies how much CPU time the unit shall get at maximum, relative to the total CPU time available on one CPU\&. Use values > 100% for allotting CPU time on more than one CPU\&. This controls the
257 "cpu\&.max"
258 attribute on the unified control group hierarchy and
259 "cpu\&.cfs_quota_us"
260 on legacy\&. For details about these control group attributes, see
261 \m[blue]\fBControl Groups v2\fR\m[]\&\s-2\u[2]\d\s+2
262 and
263 \m[blue]\fBCFS Bandwidth Control\fR\m[]\&\s-2\u[4]\d\s+2\&. Setting
264 \fICPUQuota=\fR
265 to an empty value unsets the quota\&.
266 .sp
267 Example:
268 \fICPUQuota=20%\fR
269 ensures that the executed processes will never get more than 20% CPU time on one CPU\&.
270 .sp
271 Added in version 213\&.
272 .RE
273 .PP
274 \fICPUQuotaPeriodSec=\fR
275 .RS 4
276 This setting controls the
277 \fBcpu\fR
278 controller in the unified hierarchy\&.
279 .sp
280 Assign the duration over which the CPU time quota specified by
281 \fICPUQuota=\fR
282 is measured\&. Takes a time duration value in seconds, with an optional suffix such as "ms" for milliseconds (or "s" for seconds\&.) The default setting is 100ms\&. The period is clamped to the range supported by the kernel, which is [1ms, 1000ms]\&. Additionally, the period is adjusted up so that the quota interval is also at least 1ms\&. Setting
283 \fICPUQuotaPeriodSec=\fR
284 to an empty value resets it to the default\&.
285 .sp
286 This controls the second field of
287 "cpu\&.max"
288 attribute on the unified control group hierarchy and
289 "cpu\&.cfs_period_us"
290 on legacy\&. For details about these control group attributes, see
291 \m[blue]\fBControl Groups v2\fR\m[]\&\s-2\u[2]\d\s+2
292 and
293 \m[blue]\fBCFS Scheduler\fR\m[]\&\s-2\u[3]\d\s+2\&.
294 .sp
295 Example:
296 \fICPUQuotaPeriodSec=10ms\fR
297 to request that the CPU quota is measured in periods of 10ms\&.
298 .sp
299 Added in version 242\&.
300 .RE
301 .PP
302 \fIAllowedCPUs=\fR, \fIStartupAllowedCPUs=\fR
303 .RS 4
304 This setting controls the
305 \fBcpuset\fR
306 controller in the unified hierarchy\&.
307 .sp
308 Restrict processes to be executed on specific CPUs\&. Takes a list of CPU indices or ranges separated by either whitespace or commas\&. CPU ranges are specified by the lower and upper CPU indices separated by a dash\&.
309 .sp
310 Setting
311 \fIAllowedCPUs=\fR
312 or
313 \fIStartupAllowedCPUs=\fR
314 does not guarantee that all of the CPUs will be used by the processes as it may be limited by parent units\&. The effective configuration is reported as
315 \fIEffectiveCPUs=\fR\&.
316 .sp
317 While
318 \fIStartupAllowedCPUs=\fR
319 applies to the startup and shutdown phases of the system,
320 \fIAllowedCPUs=\fR
321 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
322 \fIStartupAllowedCPUs=\fR
323 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
324 .sp
325 This setting is supported only with the unified control group hierarchy\&.
326 .sp
327 Added in version 244\&.
328 .RE
329 .SS "Memory Accounting and Control"
330 .PP
331 \fIMemoryAccounting=\fR
332 .RS 4
333 This setting controls the
334 \fBmemory\fR
335 controller in the unified hierarchy\&.
336 .sp
337 Turn on process and kernel memory accounting for this unit\&. Takes a boolean argument\&. Note that turning on memory accounting for one unit will also implicitly turn it on for all units contained in the same slice and for all its parent slices and the units contained therein\&. The system default for this setting may be controlled with
338 \fIDefaultMemoryAccounting=\fR
339 in
340 \fBsystemd-system.conf\fR(5)\&.
341 .sp
342 Added in version 208\&.
343 .RE
344 .PP
345 \fIMemoryMin=\fR\fI\fIbytes\fR\fR, \fIMemoryLow=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryLow=\fR\fI\fIbytes\fR\fR
346 .RS 4
347 These settings control the
348 \fBmemory\fR
349 controller in the unified hierarchy\&.
350 .sp
351 Specify the memory usage protection of the executed processes in this unit\&. When reclaiming memory, the unit is treated as if it was using less memory resulting in memory to be preferentially reclaimed from unprotected units\&. Using
352 \fIMemoryLow=\fR
353 results in a weaker protection where memory may still be reclaimed to avoid invoking the OOM killer in case there is no other reclaimable memory\&.
354 .sp
355 For a protection to be effective, it is generally required to set a corresponding allocation on all ancestors, which is then distributed between children (with the exception of the root slice)\&. Any
356 \fIMemoryMin=\fR
357 or
358 \fIMemoryLow=\fR
359 allocation that is not explicitly distributed to specific children is used to create a shared protection for all children\&. As this is a shared protection, the children will freely compete for the memory\&.
360 .sp
361 Takes a memory size in bytes\&. If the value is suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively\&. Alternatively, a percentage value may be specified, which is taken relative to the installed physical memory on the system\&. If assigned the special value
362 "infinity", all available memory is protected, which may be useful in order to always inherit all of the protection afforded by ancestors\&. This controls the
363 "memory\&.min"
364 or
365 "memory\&.low"
366 control group attribute\&. For details about this control group attribute, see
367 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&.
368 .sp
369 While
370 \fIStartupMemoryLow=\fR
371 applies to the startup and shutdown phases of the system,
372 \fIMemoryMin=\fR
373 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
374 \fIStartupMemoryLow=\fR
375 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
376 .sp
377 Added in version 240\&.
378 .RE
379 .PP
380 \fIMemoryHigh=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryHigh=\fR\fI\fIbytes\fR\fR
381 .RS 4
382 These settings control the
383 \fBmemory\fR
384 controller in the unified hierarchy\&.
385 .sp
386 Specify the throttling limit on memory usage of the executed processes in this unit\&. Memory usage may go above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away aggressively in such cases\&. This is the main mechanism to control memory usage of a unit\&.
387 .sp
388 Takes a memory size in bytes\&. If the value is suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively\&. Alternatively, a percentage value may be specified, which is taken relative to the installed physical memory on the system\&. If assigned the special value
389 "infinity", no memory throttling is applied\&. This controls the
390 "memory\&.high"
391 control group attribute\&. For details about this control group attribute, see
392 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&. The effective configuration is reported as
393 \fIEffectiveMemoryHigh=\fR
394 (see also
395 \fIEffectiveMemoryMax=\fR)\&.
396 .sp
397 While
398 \fIStartupMemoryHigh=\fR
399 applies to the startup and shutdown phases of the system,
400 \fIMemoryHigh=\fR
401 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
402 \fIStartupMemoryHigh=\fR
403 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
404 .sp
405 Added in version 231\&.
406 .RE
407 .PP
408 \fIMemoryMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryMax=\fR\fI\fIbytes\fR\fR
409 .RS 4
410 These settings control the
411 \fBmemory\fR
412 controller in the unified hierarchy\&.
413 .sp
414 Specify the absolute limit on memory usage of the executed processes in this unit\&. If memory usage cannot be contained under the limit, out\-of\-memory killer is invoked inside the unit\&. It is recommended to use
415 \fIMemoryHigh=\fR
416 as the main control mechanism and use
417 \fIMemoryMax=\fR
418 as the last line of defense\&.
419 .sp
420 Takes a memory size in bytes\&. If the value is suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively\&. Alternatively, a percentage value may be specified, which is taken relative to the installed physical memory on the system\&. If assigned the special value
421 "infinity", no memory limit is applied\&. This controls the
422 "memory\&.max"
423 control group attribute\&. For details about this control group attribute, see
424 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&. The effective configuration is reported as
425 \fIEffectiveMemoryMax=\fR
426 (the value is the most stringent limit of the unit and parent slices and it is capped by physical memory)\&.
427 .sp
428 While
429 \fIStartupMemoryMax=\fR
430 applies to the startup and shutdown phases of the system,
431 \fIMemoryMax=\fR
432 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
433 \fIStartupMemoryMax=\fR
434 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
435 .sp
436 Added in version 231\&.
437 .RE
438 .PP
439 \fIMemorySwapMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemorySwapMax=\fR\fI\fIbytes\fR\fR
440 .RS 4
441 These settings control the
442 \fBmemory\fR
443 controller in the unified hierarchy\&.
444 .sp
445 Specify the absolute limit on swap usage of the executed processes in this unit\&.
446 .sp
447 Takes a swap size in bytes\&. If the value is suffixed with K, M, G or T, the specified swap size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively\&. Alternatively, a percentage value may be specified, which is taken relative to the specified swap size on the system\&. If assigned the special value
448 "infinity", no swap limit is applied\&. These settings control the
449 "memory\&.swap\&.max"
450 control group attribute\&. For details about this control group attribute, see
451 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&.
452 .sp
453 While
454 \fIStartupMemorySwapMax=\fR
455 applies to the startup and shutdown phases of the system,
456 \fIMemorySwapMax=\fR
457 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
458 \fIStartupMemorySwapMax=\fR
459 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
460 .sp
461 Added in version 232\&.
462 .RE
463 .PP
464 \fIMemoryZSwapMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryZSwapMax=\fR\fI\fIbytes\fR\fR
465 .RS 4
466 These settings control the
467 \fBmemory\fR
468 controller in the unified hierarchy\&.
469 .sp
470 Specify the absolute limit on zswap usage of the processes in this unit\&. Zswap is a lightweight compressed cache for swap pages\&. It takes pages that are in the process of being swapped out and attempts to compress them into a dynamically allocated RAM\-based memory pool\&. If the limit specified is hit, no entries from this unit will be stored in the pool until existing entries are faulted back or written out to disk\&. See the kernel\*(Aqs
471 \m[blue]\fBZswap\fR\m[]\&\s-2\u[6]\d\s+2
472 documentation for more details\&.
473 .sp
474 Takes a size in bytes\&. If the value is suffixed with K, M, G or T, the specified size is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively\&. If assigned the special value
475 "infinity", no limit is applied\&. These settings control the
476 "memory\&.zswap\&.max"
477 control group attribute\&. For details about this control group attribute, see
478 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&.
479 .sp
480 While
481 \fIStartupMemoryZSwapMax=\fR
482 applies to the startup and shutdown phases of the system,
483 \fIMemoryZSwapMax=\fR
484 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
485 \fIStartupMemoryZSwapMax=\fR
486 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
487 .sp
488 Added in version 253\&.
489 .RE
490 .PP
491 \fIMemoryZSwapWriteback=\fR
492 .RS 4
493 This setting controls the
494 \fBmemory\fR
495 controller in the unified hierarchy\&.
496 .sp
497 Takes a boolean argument\&. Defaults to true if
498 \fIDefaultMemoryZSwapWriteback=\fR
499 is not set\&. When true, pages stored in the Zswap cache are permitted to be written to the backing storage, false otherwise\&. This allows disabling writeback of swap pages for IO\-intensive applications, while retaining the ability to store compressed pages in Zswap\&. See the kernel\*(Aqs
500 \m[blue]\fBZswap\fR\m[]\&\s-2\u[6]\d\s+2
501 documentation for more details\&.
502 .sp
503 The system default for this setting may be controlled with
504 \fIDefaultMemoryZSwapWriteback=\fR
505 in
506 \fBsystemd-system.conf\fR(5)\&.
507 .sp
508 Added in version 256\&.
509 .RE
510 .PP
511 \fIAllowedMemoryNodes=\fR, \fIStartupAllowedMemoryNodes=\fR
512 .RS 4
513 These settings control the
514 \fBcpuset\fR
515 controller in the unified hierarchy\&.
516 .sp
517 Restrict processes to be executed on specific memory NUMA nodes\&. Takes a list of memory NUMA nodes indices or ranges separated by either whitespace or commas\&. Memory NUMA nodes ranges are specified by the lower and upper NUMA nodes indices separated by a dash\&.
518 .sp
519 Setting
520 \fIAllowedMemoryNodes=\fR
521 or
522 \fIStartupAllowedMemoryNodes=\fR
523 does not guarantee that all of the memory NUMA nodes will be used by the processes as it may be limited by parent units\&. The effective configuration is reported as
524 \fIEffectiveMemoryNodes=\fR\&.
525 .sp
526 While
527 \fIStartupAllowedMemoryNodes=\fR
528 applies to the startup and shutdown phases of the system,
529 \fIAllowedMemoryNodes=\fR
530 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
531 \fIStartupAllowedMemoryNodes=\fR
532 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
533 .sp
534 This setting is supported only with the unified control group hierarchy\&.
535 .sp
536 Added in version 244\&.
537 .RE
538 .PP
539 \fICPUSetPartition=\fR
540 .RS 4
541 Sets the
542 \fBcpuset\fR
543 partition type for the executed processes\&. Takes one of
544 "member",
545 "root", or
546 "isolated"\&. This setting controls the
547 "cpuset\&.cpus\&.partition"
548 cgroup attribute\&.
549 .sp
550 When set to
551 "member", the cpuset operates in normal mode\&.
552 "root"
553 creates a partition root, which can further divide CPUs among child cgroups\&.
554 "isolated"
555 provides full CPU isolation, useful for real\-time workloads that require dedicated CPU resources without interference from other processes\&. Defaults to the kernel default, which is
556 "member"\&. For more details about this control group attribute, see
557 \m[blue]\fBControl Groups v2\fR\m[]\&\s-2\u[2]\d\s+2\&.
558 .sp
559 This setting requires
560 \fIAllowedCPUs=\fR
561 to also be set\&.
562 .sp
563 Added in version 261\&.
564 .RE
565 .SS "Process Accounting and Control"
566 .PP
567 \fITasksAccounting=\fR
568 .RS 4
569 This setting controls the
570 \fBpids\fR
571 controller in the unified hierarchy\&.
572 .sp
573 Turn on task accounting for this unit\&. Takes a boolean argument\&. If enabled, the kernel will keep track of the total number of tasks in the unit and its children\&. This number includes both kernel threads and userspace processes, with each thread counted individually\&. Note that turning on tasks accounting for one unit will also implicitly turn it on for all units contained in the same slice and for all its parent slices and the units contained therein\&. The system default for this setting may be controlled with
574 \fIDefaultTasksAccounting=\fR
575 in
576 \fBsystemd-system.conf\fR(5)\&.
577 .sp
578 Added in version 227\&.
579 .RE
580 .PP
581 \fITasksMax=\fR\fI\fIN\fR\fR
582 .RS 4
583 This setting controls the
584 \fBpids\fR
585 controller in the unified hierarchy\&.
586 .sp
587 Specify the maximum number of tasks that may be created in the unit\&. This ensures that the number of tasks accounted for the unit (see above) stays below a specific limit\&. This either takes an absolute number of tasks or a percentage value that is taken relative to the configured maximum number of tasks on the system\&. If assigned the special value
588 "infinity", no tasks limit is applied\&. This controls the
589 "pids\&.max"
590 control group attribute\&. For details about this control group attribute, see the
591 \m[blue]\fBpids controller\fR\m[]\&\s-2\u[7]\d\s+2\&. The effective configuration is reported as
592 \fIEffectiveTasksMax=\fR\&.
593 .sp
594 The system default for this setting may be controlled with
595 \fIDefaultTasksMax=\fR
596 in
597 \fBsystemd-system.conf\fR(5)\&.
598 .sp
599 Added in version 227\&.
600 .RE
601 .SS "IO Accounting and Control"
602 .PP
603 \fIIOAccounting=\fR
604 .RS 4
605 This setting controls the
606 \fBio\fR
607 controller in the unified hierarchy\&.
608 .sp
609 Turn on Block I/O accounting for this unit, if the unified control group hierarchy is used on the system\&. Takes a boolean argument\&. Note that turning on block I/O accounting for one unit will also implicitly turn it on for all units contained in the same slice and all for its parent slices and the units contained therein\&. The system default for this setting may be controlled with
610 \fIDefaultIOAccounting=\fR
611 in
612 \fBsystemd-system.conf\fR(5)\&.
613 .sp
614 Added in version 230\&.
615 .RE
616 .PP
617 \fIIOWeight=\fR\fI\fIweight\fR\fR, \fIStartupIOWeight=\fR\fI\fIweight\fR\fR
618 .RS 4
619 These settings control the
620 \fBio\fR
621 controller in the unified hierarchy\&.
622 .sp
623 Set the default overall block I/O weight for the executed processes, if the unified control group hierarchy is used on the system\&. Takes a single weight value (between 1 and 10000) to set the default block I/O weight\&. This controls the
624 "io\&.weight"
625 control group attribute, which defaults to 100\&. For details about this control group attribute, see
626 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&. The available I/O bandwidth is split up among all units within one slice relative to their block I/O weight\&. A higher weight means more I/O bandwidth, a lower weight means less\&.
627 .sp
628 While
629 \fIStartupIOWeight=\fR
630 applies to the startup and shutdown phases of the system,
631 \fIIOWeight=\fR
632 applies to the later runtime of the system, and if the former is not set also to the startup and shutdown phases\&. This allows prioritizing specific services at boot\-up and shutdown differently than during runtime\&.
633 .sp
634 Added in version 230\&.
635 .RE
636 .PP
637 \fIIODeviceWeight=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIweight\fR\fR
638 .RS 4
639 This setting controls the
640 \fBio\fR
641 controller in the unified hierarchy\&.
642 .sp
643 Set the per\-device overall block I/O weight for the executed processes, if the unified control group hierarchy is used on the system\&. Takes a space\-separated pair of a file path and a weight value to specify the device specific weight value, between 1 and 10000\&. (Example:
644 "/dev/sda 1000")\&. The file path may be specified as path to a block device node or as any other file, in which case the backing block device of the file system of the file is determined\&. This controls the
645 "io\&.weight"
646 control group attribute, which defaults to 100\&. Use this option multiple times to set weights for multiple devices\&. For details about this control group attribute, see
647 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
648 .sp
649 The specified device node should reference a block device that has an I/O scheduler associated, i\&.e\&. should not refer to partition or loopback block devices, but to the originating, physical device\&. When a path to a regular file or directory is specified it is attempted to discover the correct originating device backing the file system of the specified path\&. This works correctly only for simpler cases, where the file system is directly placed on a partition or physical block device, or where simple 1:1 encryption using dm\-crypt/LUKS is used\&. This discovery does not cover complex storage and in particular RAID and volume management storage devices\&.
650 .sp
651 Added in version 230\&.
652 .RE
653 .PP
654 \fIIOReadBandwidthMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR, \fIIOWriteBandwidthMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR
655 .RS 4
656 These settings control the
657 \fBio\fR
658 controller in the unified hierarchy\&.
659 .sp
660 Set the per\-device overall block I/O bandwidth maximum limit for the executed processes, if the unified control group hierarchy is used on the system\&. This limit is not work\-conserving and the executed processes are not allowed to use more even if the device has idle capacity\&. Takes a space\-separated pair of a file path and a bandwidth value (in bytes per second) to specify the device specific bandwidth\&. The file path may be a path to a block device node, or as any other file in which case the backing block device of the file system of the file is used\&. If the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes, respectively, to the base of 1000\&. (Example: "/dev/disk/by\-path/pci\-0000:00:1f\&.2\-scsi\-0:0:0:0 5M")\&. This controls the
661 "io\&.max"
662 control group attributes\&. Use this option multiple times to set bandwidth limits for multiple devices\&. For details about this control group attribute, see
663 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
664 .sp
665 Similar restrictions on block device discovery as for
666 \fIIODeviceWeight=\fR
667 apply, see above\&.
668 .sp
669 Added in version 230\&.
670 .RE
671 .PP
672 \fIIOReadIOPSMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIIOPS\fR\fR, \fIIOWriteIOPSMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIIOPS\fR\fR
673 .RS 4
674 These settings control the
675 \fBio\fR
676 controller in the unified hierarchy\&.
677 .sp
678 Set the per\-device overall block I/O IOs\-Per\-Second maximum limit for the executed processes, if the unified control group hierarchy is used on the system\&. This limit is not work\-conserving and the executed processes are not allowed to use more even if the device has idle capacity\&. Takes a space\-separated pair of a file path and an IOPS value to specify the device specific IOPS\&. The file path may be a path to a block device node, or as any other file in which case the backing block device of the file system of the file is used\&. If the IOPS is suffixed with K, M, G, or T, the specified IOPS is parsed as KiloIOPS, MegaIOPS, GigaIOPS, or TeraIOPS, respectively, to the base of 1000\&. (Example: "/dev/disk/by\-path/pci\-0000:00:1f\&.2\-scsi\-0:0:0:0 1K")\&. This controls the
679 "io\&.max"
680 control group attributes\&. Use this option multiple times to set IOPS limits for multiple devices\&. For details about this control group attribute, see
681 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
682 .sp
683 Similar restrictions on block device discovery as for
684 \fIIODeviceWeight=\fR
685 apply, see above\&.
686 .sp
687 Added in version 230\&.
688 .RE
689 .PP
690 \fIIODeviceLatencyTargetSec=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fItarget\fR\fR
691 .RS 4
692 This setting controls the
693 \fBio\fR
694 controller in the unified hierarchy\&.
695 .sp
696 Set the per\-device average target I/O latency for the executed processes, if the unified control group hierarchy is used on the system\&. Takes a file path and a timespan separated by a space to specify the device specific latency target\&. (Example: "/dev/sda 25ms")\&. The file path may be specified as path to a block device node or as any other file, in which case the backing block device of the file system of the file is determined\&. This controls the
697 "io\&.latency"
698 control group attribute\&. Use this option multiple times to set latency target for multiple devices\&. For details about this control group attribute, see
699 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
700 .sp
701 Implies
702 "IOAccounting=yes"\&.
703 .sp
704 These settings are supported only if the unified control group hierarchy is used\&.
705 .sp
706 Similar restrictions on block device discovery as for
707 \fIIODeviceWeight=\fR
708 apply, see above\&.
709 .sp
710 Added in version 240\&.
711 .RE
712 .SS "Network Accounting and Control"
713 .PP
714 \fIIPAccounting=\fR
715 .RS 4
716 Takes a boolean argument\&. If true, turns on IPv4 and IPv6 network traffic accounting for packets sent or received by the unit\&. When this option is turned on, all IPv4 and IPv6 sockets created by any process of the unit are accounted for\&.
717 .sp
718 When this option is used in socket units, it applies to all IPv4 and IPv6 sockets associated with it (including both listening and connection sockets where this applies)\&. Note that for socket\-activated services, this configuration setting and the accounting data of the service unit and the socket unit are kept separate, and displayed separately\&. No propagation of the setting and the collected statistics is done, in either direction\&. Moreover, any traffic sent or received on any of the socket unit\*(Aqs sockets is accounted to the socket unit \(em and never to the service unit it might have activated, even if the socket is used by it\&.
719 .sp
720 The system default for this setting may be controlled with
721 \fIDefaultIPAccounting=\fR
722 in
723 \fBsystemd-system.conf\fR(5)\&.
724 .sp
725 Note that this functionality is currently only available for system services, not for per\-user services\&.
726 .sp
727 Added in version 235\&.
728 .RE
729 .PP
730 \fIIPAddressAllow=\fR\fI\fIADDRESS[/PREFIXLENGTH]\&...\fR\fR, \fIIPAddressDeny=\fR\fI\fIADDRESS[/PREFIXLENGTH]\&...\fR\fR
731 .RS 4
732 Turn on network traffic filtering for IP packets sent and received over
733 \fBAF_INET\fR
734 and
735 \fBAF_INET6\fR
736 sockets\&. Both directives take a space separated list of IPv4 or IPv6 addresses, each optionally suffixed with an address prefix length in bits after a
737 "/"
738 character\&. If the suffix is omitted, the address is considered a host address, i\&.e\&. the filter covers the whole address (32 bits for IPv4, 128 bits for IPv6)\&.
739 .sp
740 The access lists configured with this option are applied to all sockets created by processes of this unit (or in the case of socket units, associated with it)\&. The lists are implicitly combined with any lists configured for any of the parent slice units this unit might be a member of\&. By default, both access lists are empty\&. Both ingress and egress traffic is filtered by these settings\&. In case of ingress traffic the source IP address is checked against these access lists, in case of egress traffic the destination IP address is checked\&. The following rules are applied in turn:
741 .sp
742 .RS 4
743 .ie n \{\
744 \h'-04'\(bu\h'+03'\c
745 .\}
746 .el \{\
747 .sp -1
748 .IP \(bu 2.3
749 .\}
750 Access is granted when the checked IP address matches an entry in the
751 \fIIPAddressAllow=\fR
752 list\&.
753 .RE
754 .sp
755 .RS 4
756 .ie n \{\
757 \h'-04'\(bu\h'+03'\c
758 .\}
759 .el \{\
760 .sp -1
761 .IP \(bu 2.3
762 .\}
763 Otherwise, access is denied when the checked IP address matches an entry in the
764 \fIIPAddressDeny=\fR
765 list\&.
766 .RE
767 .sp
768 .RS 4
769 .ie n \{\
770 \h'-04'\(bu\h'+03'\c
771 .\}
772 .el \{\
773 .sp -1
774 .IP \(bu 2.3
775 .\}
776 Otherwise, access is granted\&.
777 .RE
778 .sp
779 In order to implement an allow\-listing IP firewall, it is recommended to use a
780 \fIIPAddressDeny=\fR\fBany\fR
781 setting on an upper\-level slice unit (such as the root slice
782 \-\&.slice
783 or the slice containing all system services
784 system\&.slice
785 \(en see
786 \fBsystemd.special\fR(7)
787 for details on these slice units), plus individual per\-service
788 \fIIPAddressAllow=\fR
789 lines permitting network access to relevant services, and only them\&.
790 .sp
791 Note that for socket\-activated services, the IP access list configured on the socket unit applies to all sockets associated with it directly, but not to any sockets created by the ultimately activated services for it\&. Conversely, the IP access list configured for the service is not applied to any sockets passed into the service via socket activation\&. Thus, it is usually a good idea to replicate the IP access lists on both the socket and the service unit\&. Nevertheless, it may make sense to maintain one list more open and the other one more restricted, depending on the use case\&.
792 .sp
793 If these settings are used multiple times in the same unit the specified lists are combined\&. If an empty string is assigned to these settings the specific access list is reset and all previous settings undone\&.
794 .sp
795 In place of explicit IPv4 or IPv6 address and prefix length specifications a small set of symbolic names may be used\&. The following names are defined:
796 .sp
797 .it 1 an-trap
798 .nr an-no-space-flag 1
799 .nr an-break-flag 1
800 .br
801 .B Table\ \&1.\ \&Special address/network names
802 .TS
803 allbox tab(:);
804 lB lB lB.
805 T{
806 Symbolic Name
807 T}:T{
808 Definition
809 T}:T{
810 Meaning
811 T}
812 .T&
813 l l l
814 l l l
815 l l l
816 l l l.
817 T{
818 \fBany\fR
819 T}:T{
820 0\&.0\&.0\&.0/0 ::/0
821 T}:T{
822 Any host
823 T}
824 T{
825 \fBlocalhost\fR
826 T}:T{
827 127\&.0\&.0\&.0/8 ::1/128
828 T}:T{
829 All addresses on the local loopback
830 T}
831 T{
832 \fBlink\-local\fR
833 T}:T{
834 169\&.254\&.0\&.0/16 fe80::/64
835 T}:T{
836 All link\-local IP addresses
837 T}
838 T{
839 \fBmulticast\fR
840 T}:T{
841 224\&.0\&.0\&.0/4 ff00::/8
842 T}:T{
843 All IP multicasting addresses
844 T}
845 .TE
846 .sp 1
847 Note that these settings might not be supported on some systems (for example if eBPF control group support is not enabled in the underlying kernel or container manager)\&. These settings will have no effect in that case\&. If compatibility with such systems is desired it is hence recommended to not exclusively rely on them for IP security\&.
848 .sp
849 This option cannot be bypassed by prefixing
850 "+"
851 to the executable path in the service unit, as it applies to the whole control group\&.
852 .sp
853 Added in version 235\&.
854 .RE
855 .PP
856 \fISocketBindAllow=\fR\fI\fIbind\-rule\fR\fR, \fISocketBindDeny=\fR\fI\fIbind\-rule\fR\fR
857 .RS 4
858 Configures restrictions on the ability of unit processes to invoke
859 \fBbind\fR(2)
860 on a socket\&. Both allow and deny rules to be defined that restrict which addresses a socket may be bound to\&.
861 .sp
862 \fIbind\-rule\fR
863 describes socket properties such as
864 \fIaddress\-family\fR,
865 \fItransport\-protocol\fR
866 and
867 \fIip\-ports\fR\&.
868 .sp
869 \fIbind\-rule\fR
870 := { [\fIaddress\-family\fR\fB:\fR][\fItransport\-protocol\fR\fB:\fR][\fIip\-ports\fR] |
871 \fBany\fR
872 }
873 .sp
874 \fIaddress\-family\fR
875 := {
876 \fBipv4\fR
877 |
878 \fBipv6\fR
879 }
880 .sp
881 \fItransport\-protocol\fR
882 := {
883 \fBtcp\fR
884 |
885 \fBudp\fR
886 }
887 .sp
888 \fIip\-ports\fR
889 := {
890 \fIip\-port\fR
891 |
892 \fIip\-port\-range\fR
893 }
894 .sp
895 An optional
896 \fIaddress\-family\fR
897 expects
898 \fBipv4\fR
899 or
900 \fBipv6\fR
901 values\&. If not specified, a rule will be matched for both IPv4 and IPv6 addresses and applied depending on other socket fields, e\&.g\&.
902 \fItransport\-protocol\fR,
903 \fIip\-port\fR\&.
904 .sp
905 An optional
906 \fItransport\-protocol\fR
907 expects
908 \fBtcp\fR
909 or
910 \fBudp\fR
911 transport protocol names\&. If not specified, a rule will be matched for any transport protocol\&.
912 .sp
913 An optional
914 \fIip\-port\fR
915 value must lie within 1\&...65535 interval inclusively, i\&.e\&. dynamic port
916 \fB0\fR
917 is not allowed\&. A range of sequential ports is described by
918 \fIip\-port\-range\fR
919 :=
920 \fIip\-port\-low\fR\fB\-\fR\fIip\-port\-high\fR, where
921 \fIip\-port\-low\fR
922 is smaller than or equal to
923 \fIip\-port\-high\fR
924 and both are within 1\&...65535 inclusively\&.
925 .sp
926 A special value
927 \fBany\fR
928 can be used to apply a rule to any address family, transport protocol and any port with a positive value\&.
929 .sp
930 To allow multiple rules assign
931 \fISocketBindAllow=\fR
932 or
933 \fISocketBindDeny=\fR
934 multiple times\&. To clear the existing assignments pass an empty
935 \fISocketBindAllow=\fR
936 or
937 \fISocketBindDeny=\fR
938 assignment\&.
939 .sp
940 For each of
941 \fISocketBindAllow=\fR
942 and
943 \fISocketBindDeny=\fR, maximum allowed number of assignments is
944 \fB128\fR\&.
945 .sp
946 .RS 4
947 .ie n \{\
948 \h'-04'\(bu\h'+03'\c
949 .\}
950 .el \{\
951 .sp -1
952 .IP \(bu 2.3
953 .\}
954 Binding to a socket is allowed when a socket address matches an entry in the
955 \fISocketBindAllow=\fR
956 list\&.
957 .RE
958 .sp
959 .RS 4
960 .ie n \{\
961 \h'-04'\(bu\h'+03'\c
962 .\}
963 .el \{\
964 .sp -1
965 .IP \(bu 2.3
966 .\}
967 Otherwise, binding is denied when the socket address matches an entry in the
968 \fISocketBindDeny=\fR
969 list\&.
970 .RE
971 .sp
972 .RS 4
973 .ie n \{\
974 \h'-04'\(bu\h'+03'\c
975 .\}
976 .el \{\
977 .sp -1
978 .IP \(bu 2.3
979 .\}
980 Otherwise, binding is allowed\&.
981 .RE
982 .sp
983 The feature is implemented with
984 \fBcgroup/bind4\fR
985 and
986 \fBcgroup/bind6\fR
987 cgroup\-bpf hooks\&.
988 .sp
989 Note that these settings apply to any
990 \fBbind\fR(2)
991 system call invocation by the unit processes, regardless in which network namespace they are placed\&. Or in other words: changing the network namespace is not a suitable mechanism for escaping these restrictions on
992 \fBbind()\fR\&.
993 .sp
994 Examples:
995 .sp
996 .if n \{\
997 .RS 4
998 .\}
999 .nf
1000 \&...
1001 # Allow binding IPv6 socket addresses with a port greater than or equal to 10000\&.
1002 [Service]
1003 SocketBindAllow=ipv6:10000\-65535
1004 SocketBindDeny=any
1005 \&...
1006 # Allow binding IPv4 and IPv6 socket addresses with 1234 and 4321 ports\&.
1007 [Service]
1008 SocketBindAllow=1234
1009 SocketBindAllow=4321
1010 SocketBindDeny=any
1011 \&...
1012 # Deny binding IPv6 socket addresses\&.
1013 [Service]
1014 SocketBindDeny=ipv6
1015 \&...
1016 # Deny binding IPv4 and IPv6 socket addresses\&.
1017 [Service]
1018 SocketBindDeny=any
1019 \&...
1020 # Allow binding only over TCP
1021 [Service]
1022 SocketBindAllow=tcp
1023 SocketBindDeny=any
1024 \&...
1025 # Allow binding only over IPv6/TCP
1026 [Service]
1027 SocketBindAllow=ipv6:tcp
1028 SocketBindDeny=any
1029 \&...
1030 # Allow binding ports within 10000\-65535 range over IPv4/UDP\&.
1031 [Service]
1032 SocketBindAllow=ipv4:udp:10000\-65535
1033 SocketBindDeny=any
1034 \&...
1035 .fi
1036 .if n \{\
1037 .RE
1038 .\}
1039 .sp
1040 This option cannot be bypassed by prefixing
1041 "+"
1042 to the executable path in the service unit, as it applies to the whole control group\&.
1043 .sp
1044 Added in version 249\&.
1045 .RE
1046 .PP
1047 \fIRestrictNetworkInterfaces=\fR
1048 .RS 4
1049 Takes a list of space\-separated network interface names\&. This option restricts the network interfaces that processes of this unit can use\&. By default, processes can only use the network interfaces listed (allow\-list)\&. If the first character of the rule is
1050 "~", the effect is inverted: the processes can only use network interfaces not listed (deny\-list)\&.
1051 .sp
1052 This option can appear multiple times, in which case the network interface names are merged\&. If the empty string is assigned the set is reset, all prior assignments will have not effect\&.
1053 .sp
1054 If you specify both types of this option (i\&.e\&. allow\-listing and deny\-listing), the first encountered will take precedence and will dictate the default action (allow vs deny)\&. Then the next occurrences of this option will add or delete the listed network interface names from the set, depending of its type and the default action\&.
1055 .sp
1056 The loopback interface ("lo") is not treated in any special way, you have to configure it explicitly in the unit file\&.
1057 .sp
1058 Example 1: allow\-list
1059 .sp
1060 .if n \{\
1061 .RS 4
1062 .\}
1063 .nf
1064 RestrictNetworkInterfaces=eth1
1065 RestrictNetworkInterfaces=eth2
1066 .fi
1067 .if n \{\
1068 .RE
1069 .\}
1070 .sp
1071 Programs in the unit will be only able to use the eth1 and eth2 network interfaces\&.
1072 .sp
1073 Example 2: deny\-list
1074 .sp
1075 .if n \{\
1076 .RS 4
1077 .\}
1078 .nf
1079 RestrictNetworkInterfaces=~eth1 eth2
1080 .fi
1081 .if n \{\
1082 .RE
1083 .\}
1084 .sp
1085 Programs in the unit will be able to use any network interface but eth1 and eth2\&.
1086 .sp
1087 Example 3: mixed
1088 .sp
1089 .if n \{\
1090 .RS 4
1091 .\}
1092 .nf
1093 RestrictNetworkInterfaces=eth1 eth2
1094 RestrictNetworkInterfaces=~eth1
1095 .fi
1096 .if n \{\
1097 .RE
1098 .\}
1099 .sp
1100 Programs in the unit will be only able to use the eth2 network interface\&.
1101 .sp
1102 This option cannot be bypassed by prefixing
1103 "+"
1104 to the executable path in the service unit, as it applies to the whole control group\&.
1105 .sp
1106 Added in version 250\&.
1107 .RE
1108 .PP
1109 \fIBindNetworkInterface=\fR
1110 .RS 4
1111 Takes the name of a network interface\&. This option causes every socket created by processes of this unit to be bound to the specified network interface\&.
1112 .sp
1113 It is specially useful to confine a process to a VRF, when the program does not offer native support for it\&. It is equivalent to running the program using
1114 \fBip vrf exec\fR\&.
1115 .sp
1116 In systems using
1117 nss\-resolve, the interface used for DNS resolution can be chosen by using the
1118 \fISYSTEMD_NSS_RESOLVE_IFINDEX\fR
1119 environment variable\&.
1120 .sp
1121 The feature is implemented with
1122 \fBcgroup/sock_create\fR
1123 cgroup\-bpf hooks\&.
1124 .sp
1125 Example:
1126 .sp
1127 .if n \{\
1128 .RS 4
1129 .\}
1130 .nf
1131 [Service]
1132 BindNetworkInterface=vrf\-mgmt
1133 .fi
1134 .if n \{\
1135 .RE
1136 .\}
1137 .sp
1138 This option cannot be bypassed by prefixing
1139 "+"
1140 to the executable path in the service unit, as it applies to the whole control group\&.
1141 .sp
1142 Added in version 260\&.
1143 .RE
1144 .PP
1145 \fINFTSet=\fR\fIfamily\fR:\fItable\fR:\fIset\fR
1146 .RS 4
1147 This setting provides a method for integrating dynamic cgroup, user and group IDs into firewall rules with
1148 \m[blue]\fBNFT\fR\m[]\&\s-2\u[9]\d\s+2
1149 sets\&. The benefit of using this setting is to be able to use the IDs as selectors in firewall rules easily and this in turn allows more fine grained filtering\&. NFT rules for cgroup matching use numeric cgroup IDs, which change every time a service is restarted, making them hard to use in systemd environment otherwise\&. Dynamic and random IDs used by
1150 \fIDynamicUser=\fR
1151 can be also integrated with this setting\&.
1152 .sp
1153 This option expects a whitespace separated list of NFT set definitions\&. Each definition consists of a colon\-separated tuple of source type (one of
1154 "cgroup",
1155 "user"
1156 or
1157 "group"), NFT address family (one of
1158 "arp",
1159 "bridge",
1160 "inet",
1161 "ip",
1162 "ip6", or
1163 "netdev"), table name and set name\&. The names of tables and sets must conform to lexicographic restrictions of NFT table names\&. The type of the element used in the NFT filter must match the type implied by the directive ("cgroup",
1164 "user"
1165 or
1166 "group") as shown in the table below\&. When a control group or a unit is realized, the corresponding ID will be appended to the NFT sets and it will be be removed when the control group or unit is removed\&.
1167 \fBsystemd\fR
1168 only inserts elements to (or removes from) the sets, so the related NFT rules, tables and sets must be prepared elsewhere in advance\&. Failures to manage the sets will be ignored\&.
1169 .sp
1170 .it 1 an-trap
1171 .nr an-no-space-flag 1
1172 .nr an-break-flag 1
1173 .br
1174 .B Table\ \&2.\ \&Defined \fIsource type\fR values
1175 .TS
1176 allbox tab(:);
1177 lB lB lB.
1178 T{
1179 Source type
1180 T}:T{
1181 Description
1182 T}:T{
1183 Corresponding NFT type name
1184 T}
1185 .T&
1186 l l l
1187 l l l
1188 l l l.
1189 T{
1190 "cgroup"
1191 T}:T{
1192 control group ID
1193 T}:T{
1194 "cgroupsv2"
1195 T}
1196 T{
1197 "user"
1198 T}:T{
1199 user ID
1200 T}:T{
1201 "meta skuid"
1202 T}
1203 T{
1204 "group"
1205 T}:T{
1206 group ID
1207 T}:T{
1208 "meta skgid"
1209 T}
1210 .TE
1211 .sp 1
1212 If the firewall rules are reinstalled so that the contents of NFT sets are destroyed, command
1213 \fBsystemctl daemon\-reload\fR
1214 can be used to refill the sets\&.
1215 .sp
1216 Example:
1217 .sp
1218 .if n \{\
1219 .RS 4
1220 .\}
1221 .nf
1222 [Service]
1223 NFTSet=cgroup:inet:filter:my_service user:inet:filter:serviceuser
1224 .fi
1225 .if n \{\
1226 .RE
1227 .\}
1228 .sp
1229 Corresponding NFT rules:
1230 .sp
1231 .if n \{\
1232 .RS 4
1233 .\}
1234 .nf
1235 table inet filter {
1236 set my_service {
1237 type cgroupsv2
1238 }
1239 set serviceuser {
1240 typeof meta skuid
1241 }
1242 chain x {
1243 socket cgroupv2 level 2 @my_service accept
1244 drop
1245 }
1246 chain y {
1247 meta skuid @serviceuser accept
1248 drop
1249 }
1250 }
1251 .fi
1252 .if n \{\
1253 .RE
1254 .\}
1255 .sp
1256 This option is only available for system services and is not supported for services running in per\-user instances of the service manager\&.
1257 .sp
1258 Added in version 255\&.
1259 .RE
1260 .SS "BPF Programs"
1261 .PP
1262 \fIIPIngressFilterPath=\fR\fI\fIBPF_FS_PROGRAM_PATH\fR\fR, \fIIPEgressFilterPath=\fR\fI\fIBPF_FS_PROGRAM_PATH\fR\fR
1263 .RS 4
1264 Add custom network traffic filters implemented as BPF programs, applying to all IP packets sent and received over
1265 \fBAF_INET\fR
1266 and
1267 \fBAF_INET6\fR
1268 sockets\&. Takes an absolute path to a pinned BPF program in the BPF virtual filesystem (/sys/fs/bpf/)\&.
1269 .sp
1270 The filters configured with this option are applied to all sockets created by processes of this unit (or in the case of socket units, associated with it)\&. The filters are loaded in addition to filters any of the parent slice units this unit might be a member of as well as any
1271 \fIIPAddressAllow=\fR
1272 and
1273 \fIIPAddressDeny=\fR
1274 filters in any of these units\&. By default, there are no filters specified\&.
1275 .sp
1276 If these settings are used multiple times in the same unit all the specified programs are attached\&. If an empty string is assigned to these settings the program list is reset and all previous specified programs ignored\&.
1277 .sp
1278 If the path
1279 \fIBPF_FS_PROGRAM_PATH\fR
1280 in
1281 \fIIPIngressFilterPath=\fR
1282 assignment is already being handled by
1283 \fIBPFProgram=\fR
1284 ingress hook, e\&.g\&.
1285 \fIBPFProgram=\fR\fBingress\fR:\fIBPF_FS_PROGRAM_PATH\fR, the assignment will be still considered valid and the program will be attached to a cgroup\&. Same for
1286 \fIIPEgressFilterPath=\fR
1287 path and
1288 \fBegress\fR
1289 hook\&.
1290 .sp
1291 Note that for socket\-activated services, the IP filter programs configured on the socket unit apply to all sockets associated with it directly, but not to any sockets created by the ultimately activated services for it\&. Conversely, the IP filter programs configured for the service are not applied to any sockets passed into the service via socket activation\&. Thus, it is usually a good idea, to replicate the IP filter programs on both the socket and the service unit, however it often makes sense to maintain one configuration more open and the other one more restricted, depending on the use case\&.
1292 .sp
1293 Note that these settings might not be supported on some systems (for example if eBPF control group support is not enabled in the underlying kernel or container manager)\&. These settings will have no effect in that case\&. If compatibility with such systems is desired it is hence recommended to attach your filter manually (requires
1294 \fIDelegate=\fR\fByes\fR) instead of using this setting\&.
1295 .sp
1296 Added in version 243\&.
1297 .RE
1298 .PP
1299 \fIBPFProgram=\fR\fI\fItype\fR\fR\fI:\fR\fI\fIprogram\-path\fR\fR
1300 .RS 4
1301 \fIBPFProgram=\fR
1302 allows attaching custom BPF programs to the cgroup of a unit\&. (This generalizes the functionality exposed via
1303 \fIIPEgressFilterPath=\fR
1304 and
1305 \fIIPIngressFilterPath=\fR
1306 for other hooks\&.) Cgroup\-bpf hooks in the form of BPF programs loaded to the BPF filesystem are attached with cgroup\-bpf attach flags determined by the unit\&. For details about attachment types and flags see
1307 \m[blue]\fBbpf\&.h\fR\m[]\&\s-2\u[10]\d\s+2\&. Also refer to the general
1308 \m[blue]\fBBPF documentation\fR\m[]\&\s-2\u[11]\d\s+2\&.
1309 .sp
1310 The specification of BPF program consists of a pair of BPF program type and program path in the file system, with
1311 ":"
1312 as the separator:
1313 \fItype\fR:\fIprogram\-path\fR\&.
1314 .sp
1315 The BPF program type is equivalent to the BPF attach type used in
1316 \fBbpftool\fR(8)
1317 It may be one of
1318 \fBegress\fR,
1319 \fBingress\fR,
1320 \fBsock_create\fR,
1321 \fBsock_ops\fR,
1322 \fBdevice\fR,
1323 \fBbind4\fR,
1324 \fBbind6\fR,
1325 \fBconnect4\fR,
1326 \fBconnect6\fR,
1327 \fBpost_bind4\fR,
1328 \fBpost_bind6\fR,
1329 \fBsendmsg4\fR,
1330 \fBsendmsg6\fR,
1331 \fBsysctl\fR,
1332 \fBrecvmsg4\fR,
1333 \fBrecvmsg6\fR,
1334 \fBgetsockopt\fR, or
1335 \fBsetsockopt\fR\&.
1336 .sp
1337 The specified program path must be an absolute path referencing a BPF program inode in the bpffs file system (which generally means it must begin with
1338 /sys/fs/bpf/)\&. If a specified program does not exist (i\&.e\&. has not been uploaded to the BPF subsystem of the kernel yet), it will not be installed but unit activation will continue (a warning will be printed to the logs)\&.
1339 .sp
1340 Setting
1341 \fIBPFProgram=\fR
1342 to an empty value makes previous assignments ineffective\&.
1343 .sp
1344 Multiple assignments of the same program type/path pair have the same effect as a single assignment: the program will be attached just once\&.
1345 .sp
1346 If BPF
1347 \fBegress\fR
1348 pinned to
1349 \fIprogram\-path\fR
1350 path is already being handled by
1351 \fIIPEgressFilterPath=\fR,
1352 \fIBPFProgram=\fR
1353 assignment will be considered valid and
1354 \fIBPFProgram=\fR
1355 will be attached to a cgroup\&. Similarly for
1356 \fBingress\fR
1357 hook and
1358 \fIIPIngressFilterPath=\fR
1359 assignment\&.
1360 .sp
1361 BPF programs passed with
1362 \fIBPFProgram=\fR
1363 are attached to the cgroup of a unit with BPF attach flag
1364 \fBmulti\fR, that allows further attachments of the same
1365 \fItype\fR
1366 within cgroup hierarchy topped by the unit cgroup\&.
1367 .sp
1368 Examples:
1369 .sp
1370 .if n \{\
1371 .RS 4
1372 .\}
1373 .nf
1374 BPFProgram=egress:/sys/fs/bpf/egress\-hook
1375 BPFProgram=bind6:/sys/fs/bpf/sock\-addr\-hook
1376 .fi
1377 .if n \{\
1378 .RE
1379 .\}
1380 .sp
1381 Added in version 249\&.
1382 .RE
1383 .SS "Device Access"
1384 .PP
1385 \fIDeviceAllow=\fR
1386 .RS 4
1387 Control access to specific device nodes by the executed processes\&. Takes two space\-separated strings: a device node specifier followed by a combination of
1388 \fBr\fR,
1389 \fBw\fR,
1390 \fBm\fR
1391 to control
1392 \fIr\fReading,
1393 \fIw\fRriting, or creation of the specific device nodes by the unit (\fIm\fRknod), respectively\&. This functionality is implemented using eBPF filtering\&.
1394 .sp
1395 When access to
1396 \fIall\fR
1397 physical devices should be disallowed,
1398 \fIPrivateDevices=\fR
1399 may be used instead\&. See
1400 \fBsystemd.exec\fR(5)\&.
1401 .sp
1402 The device node specifier is either a path to a device node in the file system, starting with
1403 /dev/, or a string starting with either
1404 "char\-"
1405 or
1406 "block\-"
1407 followed by a device group name, as listed in
1408 /proc/devices\&. The latter is useful to allow\-list all current and future devices belonging to a specific device group at once\&. The device group is matched according to filename globbing rules, you may hence use the
1409 "*"
1410 and
1411 "?"
1412 wildcards\&. (Note that such globbing wildcards are not available for device node path specifications!) In order to match device nodes by numeric major/minor, use device node paths in the
1413 /dev/char/
1414 and
1415 /dev/block/
1416 directories\&. However, matching devices by major/minor is generally not recommended as assignments are neither stable nor portable between systems or different kernel versions\&.
1417 .sp
1418 Examples:
1419 /dev/sda5
1420 is a path to a device node, referring to an ATA or SCSI block device\&.
1421 "char\-pts"
1422 and
1423 "char\-alsa"
1424 are specifiers for all pseudo TTYs and all ALSA sound devices, respectively\&.
1425 "char\-cpu/*"
1426 is a specifier matching all CPU related device groups\&.
1427 .sp
1428 Note that allow lists defined this way should only reference device groups which are resolvable at the time the unit is started\&. Any device groups not resolvable then are not added to the device allow list\&. In order to work around this limitation, consider extending service units with a pair of
1429 \fBAfter=modprobe@xyz\&.service\fR
1430 and
1431 \fBWants=modprobe@xyz\&.service\fR
1432 lines that load the necessary kernel module implementing the device group if missing\&. Example:
1433 .sp
1434 .if n \{\
1435 .RS 4
1436 .\}
1437 .nf
1438 \&...
1439 [Unit]
1440 Wants=modprobe@loop\&.service
1441 After=modprobe@loop\&.service
1442
1443 [Service]
1444 DeviceAllow=block\-loop
1445 DeviceAllow=/dev/loop\-control
1446 \&...
1447 .fi
1448 .if n \{\
1449 .RE
1450 .\}
1451 .sp
1452 This option cannot be bypassed by prefixing
1453 "+"
1454 to the executable path in the service unit, as it applies to the whole control group\&.
1455 .sp
1456 Added in version 208\&.
1457 .RE
1458 .PP
1459 \fIDevicePolicy=auto|closed|strict\fR
1460 .RS 4
1461 Control the policy for allowing device access:
1462 .PP
1463 \fBstrict\fR
1464 .RS 4
1465 means to only allow types of access that are explicitly specified\&.
1466 .sp
1467 Added in version 208\&.
1468 .RE
1469 .PP
1470 \fBclosed\fR
1471 .RS 4
1472 in addition, allows access to standard pseudo devices including
1473 /dev/null,
1474 /dev/zero,
1475 /dev/full,
1476 /dev/random, and
1477 /dev/urandom\&.
1478 .sp
1479 Added in version 208\&.
1480 .RE
1481 .PP
1482 \fBauto\fR
1483 .RS 4
1484 in addition, allows access to all devices if no explicit
1485 \fIDeviceAllow=\fR
1486 is present\&. This is the default\&.
1487 .sp
1488 Added in version 208\&.
1489 .RE
1490 .sp
1491 This option cannot be bypassed by prefixing
1492 "+"
1493 to the executable path in the service unit, as it applies to the whole control group\&.
1494 .sp
1495 Added in version 208\&.
1496 .RE
1497 .SS "Control Group Management"
1498 .PP
1499 \fISlice=\fR
1500 .RS 4
1501 The name of the slice unit to place the unit in\&. Defaults to
1502 system\&.slice
1503 for all non\-instantiated units of all unit types (except for slice units themselves see below)\&. Instance units are by default placed in a subslice of
1504 system\&.slice
1505 that is named after the template name\&.
1506 .sp
1507 This option may be used to arrange systemd units in a hierarchy of slices each of which might have resource settings applied\&.
1508 .sp
1509 For units of type slice, the only accepted value for this setting is the parent slice\&. Since the name of a slice unit implies the parent slice, it is hence redundant to ever set this parameter directly for slice units\&.
1510 .sp
1511 Special care should be taken when relying on the default slice assignment in templated service units that have
1512 \fIDefaultDependencies=no\fR
1513 set, see
1514 \fBsystemd.service\fR(5), section "Default Dependencies" for details\&.
1515 .sp
1516 Added in version 208\&.
1517 .RE
1518 .PP
1519 \fIDelegate=\fR
1520 .RS 4
1521 Turns on delegation of further resource control partitioning to processes of the unit\&. Units where this is enabled may create and manage their own private subhierarchy of control groups below the control group of the unit itself\&. For unprivileged services (i\&.e\&. those using the
1522 \fIUser=\fR
1523 setting) the unit\*(Aqs control group will be made accessible to the relevant user\&.
1524 .sp
1525 When enabled the service manager will refrain from manipulating control groups or moving processes below the unit\*(Aqs control group, so that a clear concept of ownership is established: the control group tree at the level of the unit\*(Aqs control group and above (i\&.e\&. towards the root control group) is owned and managed by the service manager of the host, while the control group tree below the unit\*(Aqs control group is owned and managed by the unit itself\&.
1526 .sp
1527 Takes either a boolean argument or a (possibly empty) list of control group controller names\&. If true, delegation is turned on, and all supported controllers are enabled for the unit, making them available to the unit\*(Aqs processes for management\&. If false, delegation is turned off entirely (and no additional controllers are enabled)\&. If set to a list of controllers, delegation is turned on, and the specified controllers are enabled for the unit\&. Assigning the empty string will enable delegation, but reset the list of controllers, and all assignments prior to this will have no effect\&. Note that additional controllers other than the ones specified might be made available as well, depending on configuration of the containing slice unit or other units contained in it\&. Defaults to false\&.
1528 .sp
1529 Note that controller delegation to less privileged code is only safe on the unified control group hierarchy\&. Accordingly, access to the specified controllers will not be granted to unprivileged services on the legacy hierarchy, even when requested\&.
1530 .sp
1531 The following controller names may be specified:
1532 \fBcpu\fR,
1533 \fBcpuset\fR,
1534 \fBio\fR,
1535 \fBmemory\fR,
1536 \fBpids\fR,
1537 \fBbpf\-firewall\fR,
1538 \fBbpf\-devices\fR,
1539 \fBbpf\-foreign\fR,
1540 \fBbpf\-socket\-bind\fR,
1541 \fBbpf\-restrict\-network\-interfaces\fR, and
1542 \fBbpf\-bind\-network\-interface\fR\&.
1543 .sp
1544 Not all of these controllers are available on all kernels however, and some are specific to the unified hierarchy while others are specific to the legacy hierarchy\&. Also note that the kernel might support further controllers, which are not covered here yet, as delegation is either not supported at all for them or not defined cleanly\&.
1545 .sp
1546 Note that because of the hierarchical nature of cgroup hierarchy, any controllers that are delegated will be enabled for the parent and sibling units of the unit with delegation\&.
1547 .sp
1548 For further details on the delegation model consult
1549 \m[blue]\fBControl Group APIs and Delegation\fR\m[]\&\s-2\u[12]\d\s+2\&.
1550 .sp
1551 Added in version 218\&.
1552 .RE
1553 .PP
1554 \fIDelegateSubgroup=\fR
1555 .RS 4
1556 Place unit processes in the specified subgroup of the unit\*(Aqs control group\&. Takes a valid control group name (not a path!) as parameter, or an empty string to turn this feature off\&. Defaults to off\&. The control group name must be usable as filename and avoid conflicts with the kernel\*(Aqs control group attribute files (i\&.e\&.
1557 cgroup\&.procs
1558 is not an acceptable name, since the kernel exposes a native control group attribute file by that name)\&. This option has no effect unless control group delegation is turned on via
1559 \fIDelegate=\fR, see above\&. Note that this setting only applies to "main" processes of a unit, i\&.e\&. for services to
1560 \fIExecStart=\fR, but not for
1561 \fIExecReload=\fR
1562 and similar\&. If delegation is enabled, the latter are always placed inside a subgroup named
1563 \&.control\&. The specified subgroup is automatically created (and potentially ownership is passed to the unit\*(Aqs configured user/group) when a process is started in it\&.
1564 .sp
1565 This option is useful to avoid manually moving the invoked process into a subgroup after it has been started\&. Since no processes should live in inner nodes of the control group tree it is almost always necessary to run the main ("supervising") process of a unit that has delegation turned on in a subgroup\&.
1566 .sp
1567 Added in version 254\&.
1568 .RE
1569 .PP
1570 \fIDisableControllers=\fR
1571 .RS 4
1572 Disables controllers from being enabled for a unit\*(Aqs children\&. If a controller listed is already in use in its subtree, the controller will be removed from the subtree\&. This can be used to avoid configuration in child units from being able to implicitly or explicitly enable a controller\&. Defaults to empty\&.
1573 .sp
1574 Multiple controllers may be specified, separated by spaces\&. You may also pass
1575 \fIDisableControllers=\fR
1576 multiple times, in which case each new instance adds another controller to disable\&. Passing
1577 \fIDisableControllers=\fR
1578 by itself with no controller name present resets the disabled controller list\&.
1579 .sp
1580 It may not be possible to disable a controller after units have been started, if the unit or any child of the unit in question delegates controllers to its children, as any delegated subtree of the cgroup hierarchy is unmanaged by systemd\&.
1581 .sp
1582 The following controller names may be specified:
1583 \fBcpu\fR,
1584 \fBcpuset\fR,
1585 \fBio\fR,
1586 \fBmemory\fR,
1587 \fBpids\fR,
1588 \fBbpf\-firewall\fR,
1589 \fBbpf\-devices\fR,
1590 \fBbpf\-foreign\fR,
1591 \fBbpf\-socket\-bind\fR,
1592 \fBbpf\-restrict\-network\-interfaces\fR, and
1593 \fBbpf\-bind\-network\-interface\fR\&.
1594 .sp
1595 Added in version 240\&.
1596 .RE
1597 .SS "Memory Pressure Control"
1598 .PP
1599 \fIManagedOOMSwap=auto|kill\fR, \fIManagedOOMMemoryPressure=auto|kill\fR
1600 .RS 4
1601 Specifies how
1602 \fBsystemd-oomd.service\fR(8)
1603 will act on this unit\*(Aqs cgroups\&. Defaults to
1604 \fBauto\fR\&.
1605 .sp
1606 When set to
1607 \fBkill\fR, the unit becomes a candidate for monitoring by
1608 \fBsystemd\-oomd\fR\&. If the cgroup passes the limits set by
1609 \fBoomd.conf\fR(5)
1610 or the unit configuration,
1611 \fBsystemd\-oomd\fR
1612 will select a descendant cgroup and send
1613 \fBSIGKILL\fR
1614 to all of the processes under it\&. You can find more details on candidates and kill behavior at
1615 \fBsystemd-oomd.service\fR(8)
1616 and
1617 \fBoomd.conf\fR(5)\&.
1618 .sp
1619 Setting either of these properties to
1620 \fBkill\fR
1621 will also result in
1622 \fIAfter=\fR
1623 and
1624 \fIWants=\fR
1625 dependencies on
1626 systemd\-oomd\&.service
1627 unless
1628 \fIDefaultDependencies=no\fR\&.
1629 .sp
1630 When set to
1631 \fBauto\fR,
1632 \fBsystemd\-oomd\fR
1633 will not actively use this cgroup\*(Aqs data for monitoring and detection\&. However, if an ancestor cgroup has one of these properties set to
1634 \fBkill\fR, a unit with
1635 \fBauto\fR
1636 can still be a candidate for
1637 \fBsystemd\-oomd\fR
1638 to terminate\&.
1639 .sp
1640 Added in version 247\&.
1641 .RE
1642 .PP
1643 \fIManagedOOMMemoryPressureLimit=\fR
1644 .RS 4
1645 Overrides the default memory pressure limit set by
1646 \fBoomd.conf\fR(5)
1647 for the cgroup of this unit\&. Takes a percentage value between 0% and 100%, inclusive\&. Defaults to 0%, which means to use the default set by
1648 \fBoomd.conf\fR(5)\&. This property is ignored unless
1649 \fIManagedOOMMemoryPressure=\fR\fBkill\fR\&.
1650 .sp
1651 Added in version 247\&.
1652 .RE
1653 .PP
1654 \fIManagedOOMMemoryPressureDurationSec=\fR
1655 .RS 4
1656 Overrides the default memory pressure duration set by
1657 \fBoomd.conf\fR(5)
1658 for the cgroup of this unit\&. The specified value supports a time unit such as
1659 "ms"
1660 or
1661 "μs", see
1662 \fBsystemd.time\fR(7)
1663 for details on the permitted syntax\&. Must be set to either empty or a value of at least 1s\&. Defaults to empty, which means to use the default set by
1664 \fBoomd.conf\fR(5)\&. This property is ignored unless
1665 \fIManagedOOMMemoryPressure=\fR\fBkill\fR\&.
1666 .sp
1667 Added in version 257\&.
1668 .RE
1669 .PP
1670 \fIManagedOOMPreference=none|avoid|omit\fR
1671 .RS 4
1672 Allows deprioritizing or omitting this unit\*(Aqs cgroup as a candidate when
1673 \fBsystemd\-oomd\fR
1674 needs to act\&. Requires support for extended attributes (see
1675 \fBxattr\fR(7)) in order to use
1676 \fBavoid\fR
1677 or
1678 \fBomit\fR\&.
1679 .sp
1680 When calculating candidates to relieve swap usage,
1681 \fBsystemd\-oomd\fR
1682 will only respect these extended attributes if the unit\*(Aqs cgroup is owned by root\&.
1683 .sp
1684 When calculating candidates to relieve memory pressure,
1685 \fBsystemd\-oomd\fR
1686 will only respect these extended attributes if the unit\*(Aqs cgroup is owned by root, or if the unit\*(Aqs cgroup owner, and the owner of the monitored ancestor cgroup are the same\&. For example, if
1687 \fBsystemd\-oomd\fR
1688 is calculating candidates for
1689 \-\&.slice, then extended attributes set on descendants of
1690 /user\&.slice/user\-1000\&.slice/user@1000\&.service/
1691 will be ignored because the descendants are owned by UID 1000, and
1692 \-\&.slice
1693 is owned by UID 0\&. But, if calculating candidates for
1694 /user\&.slice/user\-1000\&.slice/user@1000\&.service/, then extended attributes set on the descendants would be respected\&.
1695 .sp
1696 If this property is set to
1697 \fBavoid\fR, the service manager will convey this to
1698 \fBsystemd\-oomd\fR, which will only select this cgroup if there are no other viable candidates\&.
1699 .sp
1700 If this property is set to
1701 \fBomit\fR, the service manager will convey this to
1702 \fBsystemd\-oomd\fR, which will ignore this cgroup as a candidate and will not perform any actions on it\&.
1703 .sp
1704 It is recommended to use
1705 \fBavoid\fR
1706 and
1707 \fBomit\fR
1708 sparingly, as it can adversely affect
1709 \fBsystemd\-oomd\fR\*(Aqs kill behavior\&. Also note that these extended attributes are not applied recursively to cgroups under this unit\*(Aqs cgroup\&.
1710 .sp
1711 Defaults to
1712 \fBnone\fR
1713 which means
1714 \fBsystemd\-oomd\fR
1715 will rank this unit\*(Aqs cgroup as defined in
1716 \fBsystemd-oomd.service\fR(8)
1717 and
1718 \fBoomd.conf\fR(5)\&.
1719 .sp
1720 Added in version 248\&.
1721 .RE
1722 .PP
1723 \fIOOMRules=\fR
1724 .RS 4
1725 Takes a space\-separated list of OOM ruleset names\&. The rulesets are defined in
1726 \&.oomrule
1727 files placed in
1728 /etc/systemd/oomd/rules\&.d/,
1729 /run/systemd/oomd/rules\&.d/,
1730 /usr/local/lib/systemd/oomd/rules\&.d/, or
1731 /usr/lib/systemd/oomd/rules\&.d/\&. When set,
1732 \fBsystemd-oomd.service\fR(8)
1733 will monitor this unit\*(Aqs cgroup and evaluate the specified rulesets against it\&. Each ruleset defines conditions (such as memory pressure or swap usage thresholds) and an action to take when those conditions are met\&. See
1734 \fBoomd.conf\fR(5)
1735 for details on the available ruleset options\&.
1736 .sp
1737 Setting this property will also result in
1738 \fIAfter=\fR
1739 and
1740 \fIWants=\fR
1741 dependencies on
1742 systemd\-oomd\&.service
1743 unless
1744 \fIDefaultDependencies=no\fR\&.
1745 .sp
1746 Defaults to an empty list, which means no rulesets are applied\&. Note that each monitored cgroup incurs a per\-interval walk of its descendant cgroup tree, so monitoring very large numbers of cgroups via
1747 \fIOOMRules=\fR
1748 may have a measurable performance impact\&.
1749 .sp
1750 Added in version 261\&.
1751 .RE
1752 .PP
1753 \fIMemoryPressureWatch=\fR
1754 .RS 4
1755 Controls memory pressure monitoring for invoked processes\&. Takes a boolean or one of
1756 "auto"
1757 and
1758 "skip"\&. If
1759 "no", tells the service not to watch for memory pressure events, by setting the
1760 \fI$MEMORY_PRESSURE_WATCH\fR
1761 environment variable to the literal string
1762 /dev/null\&. If
1763 "yes", tells the service to watch for memory pressure events\&. This enables memory accounting for the service, and ensures the
1764 memory\&.pressure
1765 cgroup attribute file is accessible for reading and writing by the service\*(Aqs user\&. It then sets the
1766 \fI$MEMORY_PRESSURE_WATCH\fR
1767 environment variable for processes invoked by the unit to the file system path to this file\&. The threshold information configured with
1768 \fIMemoryPressureThresholdSec=\fR
1769 is encoded in the
1770 \fI$MEMORY_PRESSURE_WRITE\fR
1771 environment variable\&. If the
1772 "auto"
1773 value is set the protocol is enabled if memory accounting is anyway enabled for the unit, and disabled otherwise\&. If set to
1774 "skip"
1775 the logic is neither enabled, nor disabled and the two environment variables are not set\&.
1776 .sp
1777 Note that services are free to use the two environment variables, but it is unproblematic if they ignore them\&. Memory pressure handling must be implemented individually in each service, and usually means different things for different software\&. For further details on memory pressure handling see
1778 \m[blue]\fBResource Pressure Handling in systemd\fR\m[]\&\s-2\u[13]\d\s+2\&.
1779 .sp
1780 Services implemented using
1781 \fBsd-event\fR(3)
1782 may use
1783 \fBsd_event_add_memory_pressure\fR(3)
1784 to watch for and handle memory pressure events\&.
1785 .sp
1786 If not explicit set, defaults to the
1787 \fIDefaultMemoryPressureWatch=\fR
1788 setting in
1789 \fBsystemd-system.conf\fR(5)\&.
1790 .sp
1791 Added in version 254\&.
1792 .RE
1793 .PP
1794 \fIMemoryPressureThresholdSec=\fR
1795 .RS 4
1796 Sets the memory pressure threshold time for memory pressure monitor as configured via
1797 \fIMemoryPressureWatch=\fR\&. Specifies the maximum allocation latency before a memory pressure event is signalled to the service, per 2s window\&. If not specified, defaults to the
1798 \fIDefaultMemoryPressureThresholdSec=\fR
1799 setting in
1800 \fBsystemd-system.conf\fR(5)
1801 (which in turn defaults to 200ms)\&. The specified value expects a time unit such as
1802 "ms"
1803 or
1804 "μs", see
1805 \fBsystemd.time\fR(7)
1806 for details on the permitted syntax\&.
1807 .sp
1808 Added in version 254\&.
1809 .RE
1810 .PP
1811 \fICPUPressureWatch=\fR
1812 .RS 4
1813 Controls CPU pressure monitoring for invoked processes\&. Takes a boolean or one of
1814 "auto"
1815 and
1816 "skip"\&. If
1817 "no", tells the service not to watch for CPU pressure events, by setting the
1818 \fI$CPU_PRESSURE_WATCH\fR
1819 environment variable to the literal string
1820 /dev/null\&. If
1821 "yes", tells the service to watch for CPU pressure events\&. This ensures the
1822 cpu\&.pressure
1823 cgroup attribute file is accessible for reading and writing by the service\*(Aqs user\&. It then sets the
1824 \fI$CPU_PRESSURE_WATCH\fR
1825 environment variable for processes invoked by the unit to the file system path to this file\&. The threshold information configured with
1826 \fICPUPressureThresholdSec=\fR
1827 is encoded in the
1828 \fI$CPU_PRESSURE_WRITE\fR
1829 environment variable\&. If the
1830 "auto"
1831 value is set the protocol is enabled if CPU resource controls are configured for the unit (e\&.g\&. because
1832 \fICPUWeight=\fR
1833 or
1834 \fICPUQuota=\fR
1835 is set), and disabled otherwise\&. If set to
1836 "skip"
1837 the logic is neither enabled, nor disabled and the two environment variables are not set\&.
1838 .sp
1839 Note that services are free to use the two environment variables, but it is unproblematic if they ignore them\&. CPU pressure handling must be implemented individually in each service, and usually means different things for different software\&.
1840 .sp
1841 Services implemented using
1842 \fBsd-event\fR(3)
1843 may use
1844 \fBsd_event_add_cpu_pressure\fR(3)
1845 to watch for and handle CPU pressure events\&.
1846 .sp
1847 If not explicitly set, defaults to the
1848 \fIDefaultCPUPressureWatch=\fR
1849 setting in
1850 \fBsystemd-system.conf\fR(5)\&.
1851 .sp
1852 Added in version 261\&.
1853 .RE
1854 .PP
1855 \fICPUPressureThresholdSec=\fR
1856 .RS 4
1857 Sets the CPU pressure threshold time for CPU pressure monitor as configured via
1858 \fICPUPressureWatch=\fR\&. Specifies the maximum CPU stall time before a CPU pressure event is signalled to the service, per 2s window\&. If not specified, defaults to the
1859 \fIDefaultCPUPressureThresholdSec=\fR
1860 setting in
1861 \fBsystemd-system.conf\fR(5)
1862 (which in turn defaults to 200ms)\&. The specified value expects a time unit such as
1863 "ms"
1864 or
1865 "μs", see
1866 \fBsystemd.time\fR(7)
1867 for details on the permitted syntax\&.
1868 .sp
1869 Added in version 261\&.
1870 .RE
1871 .PP
1872 \fIIOPressureWatch=\fR
1873 .RS 4
1874 Controls IO pressure monitoring for invoked processes\&. Takes a boolean or one of
1875 "auto"
1876 and
1877 "skip"\&. If
1878 "no", tells the service not to watch for IO pressure events, by setting the
1879 \fI$IO_PRESSURE_WATCH\fR
1880 environment variable to the literal string
1881 /dev/null\&. If
1882 "yes", tells the service to watch for IO pressure events\&. This enables IO accounting for the service, and ensures the
1883 io\&.pressure
1884 cgroup attribute file is accessible for reading and writing by the service\*(Aqs user\&. It then sets the
1885 \fI$IO_PRESSURE_WATCH\fR
1886 environment variable for processes invoked by the unit to the file system path to this file\&. The threshold information configured with
1887 \fIIOPressureThresholdSec=\fR
1888 is encoded in the
1889 \fI$IO_PRESSURE_WRITE\fR
1890 environment variable\&. If the
1891 "auto"
1892 value is set the protocol is enabled if IO accounting is anyway enabled for the unit (e\&.g\&. because
1893 \fIIOWeight=\fR
1894 or
1895 \fIIODeviceWeight=\fR
1896 is set), and disabled otherwise\&. If set to
1897 "skip"
1898 the logic is neither enabled, nor disabled and the two environment variables are not set\&.
1899 .sp
1900 Note that services are free to use the two environment variables, but it is unproblematic if they ignore them\&. IO pressure handling must be implemented individually in each service, and usually means different things for different software\&.
1901 .sp
1902 Services implemented using
1903 \fBsd-event\fR(3)
1904 may use
1905 \fBsd_event_add_io_pressure\fR(3)
1906 to watch for and handle IO pressure events\&.
1907 .sp
1908 If not explicitly set, defaults to the
1909 \fIDefaultIOPressureWatch=\fR
1910 setting in
1911 \fBsystemd-system.conf\fR(5)\&.
1912 .sp
1913 Added in version 261\&.
1914 .RE
1915 .PP
1916 \fIIOPressureThresholdSec=\fR
1917 .RS 4
1918 Sets the IO pressure threshold time for IO pressure monitor as configured via
1919 \fIIOPressureWatch=\fR\&. Specifies the maximum IO stall time before an IO pressure event is signalled to the service, per 2s window\&. If not specified, defaults to the
1920 \fIDefaultIOPressureThresholdSec=\fR
1921 setting in
1922 \fBsystemd-system.conf\fR(5)
1923 (which in turn defaults to 200ms)\&. The specified value expects a time unit such as
1924 "ms"
1925 or
1926 "μs", see
1927 \fBsystemd.time\fR(7)
1928 for details on the permitted syntax\&.
1929 .sp
1930 Added in version 261\&.
1931 .RE
1932 .SS "Coredump Control"
1933 .PP
1934 \fICoredumpReceive=\fR
1935 .RS 4
1936 Takes a boolean argument\&. This setting is used to enable coredump forwarding for containers that belong to this unit\*(Aqs cgroup\&. Units with
1937 \fICoredumpReceive=yes\fR
1938 must also be configured with
1939 \fIDelegate=yes\fR\&. Defaults to false\&.
1940 .sp
1941 When
1942 \fBsystemd\-coredump\fR
1943 is handling a coredump for a process from a container, if the container\*(Aqs leader process is a descendant of a cgroup with
1944 \fICoredumpReceive=yes\fR
1945 and
1946 \fIDelegate=yes\fR, then
1947 \fBsystemd\-coredump\fR
1948 will attempt to forward the coredump to
1949 \fBsystemd\-coredump\fR
1950 within the container\&. See also
1951 \fBsystemd-coredump\fR(8)\&.
1952 .sp
1953 Added in version 255\&.
1954 .RE
1955 .SH "HISTORY"
1956 .PP
1957 systemd 252
1958 .RS 4
1959 Options for controlling the Legacy Control Group Hierarchy (\m[blue]\fBControl Groups version 1\fR\m[]\&\s-2\u[14]\d\s+2) are now fully deprecated:
1960 \fICPUShares=\fR\fI\fIweight\fR\fR,
1961 \fIStartupCPUShares=\fR\fI\fIweight\fR\fR,
1962 \fIMemoryLimit=\fR\fI\fIbytes\fR\fR,
1963 \fIBlockIOAccounting=\fR,
1964 \fIBlockIOWeight=\fR\fI\fIweight\fR\fR,
1965 \fIStartupBlockIOWeight=\fR\fI\fIweight\fR\fR,
1966 \fIBlockIODeviceWeight=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIweight\fR\fR,
1967 \fIBlockIOReadBandwidth=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR,
1968 \fIBlockIOWriteBandwidth=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR\&. Please switch to the unified cgroup hierarchy\&.
1969 .RE
1970 .PP
1971 systemd 258
1972 .RS 4
1973 \fICPUAccounting=\fR
1974 setting is deprecated, because it is always available on the unified cgroup hierarchy and such setting has no effect\&.
1975 .RE
1976 .SH "SEE ALSO"
1977 .PP
1978 \fBsystemd\fR(1), \fBsystemd-system.conf\fR(5), \fBsystemd.unit\fR(5), \fBsystemd.service\fR(5), \fBsystemd.slice\fR(5), \fBsystemd.scope\fR(5), \fBsystemd.socket\fR(5), \fBsystemd.mount\fR(5), \fBsystemd.swap\fR(5), \fBsystemd.exec\fR(5), \fBsystemd.directives\fR(7), \fBsystemd.special\fR(7), \fBsystemd-oomd.service\fR(8), The documentation for control groups and specific controllers in the Linux kernel: \m[blue]\fBControl Groups v2\fR\m[]\&\s-2\u[2]\d\s+2
1979 .SH "NOTES"
1980 .IP " 1." 4
1981 New Control Group Interfaces
1982 .RS 4
1983 \%https://systemd.io/CONTROL_GROUP_INTERFACE
1984 .RE
1985 .IP " 2." 4
1986 Control Groups v2
1987 .RS 4
1988 \%https://docs.kernel.org/admin-guide/cgroup-v2.html
1989 .RE
1990 .IP " 3." 4
1991 CFS Scheduler
1992 .RS 4
1993 \%https://docs.kernel.org/scheduler/sched-design-CFS.html
1994 .RE
1995 .IP " 4." 4
1996 CFS Bandwidth Control
1997 .RS 4
1998 \%https://docs.kernel.org/scheduler/sched-bwc.html
1999 .RE
2000 .IP " 5." 4
2001 Memory Interface Files
2002 .RS 4
2003 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files
2004 .RE
2005 .IP " 6." 4
2006 Zswap
2007 .RS 4
2008 \%https://docs.kernel.org/admin-guide/mm/zswap.html
2009 .RE
2010 .IP " 7." 4
2011 pids controller
2012 .RS 4
2013 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#pid
2014 .RE
2015 .IP " 8." 4
2016 IO Interface Files
2017 .RS 4
2018 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files
2019 .RE
2020 .IP " 9." 4
2021 NFT
2022 .RS 4
2023 \%https://netfilter.org/projects/nftables/index.html
2024 .RE
2025 .IP "10." 4
2026 bpf.h
2027 .RS 4
2028 \%https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf.h
2029 .RE
2030 .IP "11." 4
2031 BPF documentation
2032 .RS 4
2033 \%https://docs.kernel.org/bpf/
2034 .RE
2035 .IP "12." 4
2036 Control Group APIs and Delegation
2037 .RS 4
2038 \%https://systemd.io/CGROUP_DELEGATION
2039 .RE
2040 .IP "13." 4
2041 Resource Pressure Handling in systemd
2042 .RS 4
2043 \%https://systemd.io/PRESSURE
2044 .RE
2045 .IP "14." 4
2046 Control Groups version 1
2047 .RS 4
2048 \%https://docs.kernel.org/admin-guide/cgroup-v1/index.html
2049 .RE