Debian Codegraph @

upstream/mageia-cauldron/man5/systemd.resource-control.5

raw
1 '\" t
2 .TH "SYSTEMD\&.RESOURCE\-CONTROL" "5" "" "systemd 258.7" "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, \fIDefaultStartupMemoryLow=\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 Units may have their children use a default
370 "memory\&.min"
371 or
372 "memory\&.low"
373 value by specifying
374 \fIDefaultMemoryMin=\fR
375 or
376 \fIDefaultMemoryLow=\fR, which has the same semantics as
377 \fIMemoryMin=\fR
378 and
379 \fIMemoryLow=\fR, or
380 \fIDefaultStartupMemoryLow=\fR
381 which has the same semantics as
382 \fIStartupMemoryLow=\fR\&. This setting does not affect
383 "memory\&.min"
384 or
385 "memory\&.low"
386 in the unit itself\&. Using it to set a default child allocation is only useful on kernels older than 5\&.7, which do not support the
387 "memory_recursiveprot"
388 cgroup2 mount option\&.
389 .sp
390 While
391 \fIStartupMemoryLow=\fR
392 applies to the startup and shutdown phases of the system,
393 \fIMemoryMin=\fR
394 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
395 \fIStartupMemoryLow=\fR
396 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
397 .sp
398 Added in version 240\&.
399 .RE
400 .PP
401 \fIMemoryHigh=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryHigh=\fR\fI\fIbytes\fR\fR
402 .RS 4
403 These settings control the
404 \fBmemory\fR
405 controller in the unified hierarchy\&.
406 .sp
407 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\&.
408 .sp
409 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
410 "infinity", no memory throttling is applied\&. This controls the
411 "memory\&.high"
412 control group attribute\&. For details about this control group attribute, see
413 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&. The effective configuration is reported as
414 \fIEffectiveMemoryHigh=\fR
415 (see also
416 \fIEffectiveMemoryMax=\fR)\&.
417 .sp
418 While
419 \fIStartupMemoryHigh=\fR
420 applies to the startup and shutdown phases of the system,
421 \fIMemoryHigh=\fR
422 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
423 \fIStartupMemoryHigh=\fR
424 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
425 .sp
426 Added in version 231\&.
427 .RE
428 .PP
429 \fIMemoryMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryMax=\fR\fI\fIbytes\fR\fR
430 .RS 4
431 These settings control the
432 \fBmemory\fR
433 controller in the unified hierarchy\&.
434 .sp
435 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
436 \fIMemoryHigh=\fR
437 as the main control mechanism and use
438 \fIMemoryMax=\fR
439 as the last line of defense\&.
440 .sp
441 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
442 "infinity", no memory limit is applied\&. This controls the
443 "memory\&.max"
444 control group attribute\&. For details about this control group attribute, see
445 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&. The effective configuration is reported as
446 \fIEffectiveMemoryMax=\fR
447 (the value is the most stringent limit of the unit and parent slices and it is capped by physical memory)\&.
448 .sp
449 While
450 \fIStartupMemoryMax=\fR
451 applies to the startup and shutdown phases of the system,
452 \fIMemoryMax=\fR
453 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
454 \fIStartupMemoryMax=\fR
455 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
456 .sp
457 Added in version 231\&.
458 .RE
459 .PP
460 \fIMemorySwapMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemorySwapMax=\fR\fI\fIbytes\fR\fR
461 .RS 4
462 These settings control the
463 \fBmemory\fR
464 controller in the unified hierarchy\&.
465 .sp
466 Specify the absolute limit on swap usage of the executed processes in this unit\&.
467 .sp
468 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
469 "infinity", no swap limit is applied\&. These settings control the
470 "memory\&.swap\&.max"
471 control group attribute\&. For details about this control group attribute, see
472 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&.
473 .sp
474 While
475 \fIStartupMemorySwapMax=\fR
476 applies to the startup and shutdown phases of the system,
477 \fIMemorySwapMax=\fR
478 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
479 \fIStartupMemorySwapMax=\fR
480 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
481 .sp
482 Added in version 232\&.
483 .RE
484 .PP
485 \fIMemoryZSwapMax=\fR\fI\fIbytes\fR\fR, \fIStartupMemoryZSwapMax=\fR\fI\fIbytes\fR\fR
486 .RS 4
487 These settings control the
488 \fBmemory\fR
489 controller in the unified hierarchy\&.
490 .sp
491 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
492 \m[blue]\fBZswap\fR\m[]\&\s-2\u[6]\d\s+2
493 documentation for more details\&.
494 .sp
495 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
496 "infinity", no limit is applied\&. These settings control the
497 "memory\&.zswap\&.max"
498 control group attribute\&. For details about this control group attribute, see
499 \m[blue]\fBMemory Interface Files\fR\m[]\&\s-2\u[5]\d\s+2\&.
500 .sp
501 While
502 \fIStartupMemoryZSwapMax=\fR
503 applies to the startup and shutdown phases of the system,
504 \fIMemoryZSwapMax=\fR
505 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
506 \fIStartupMemoryZSwapMax=\fR
507 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
508 .sp
509 Added in version 253\&.
510 .RE
511 .PP
512 \fIMemoryZSwapWriteback=\fR
513 .RS 4
514 This setting controls the
515 \fBmemory\fR
516 controller in the unified hierarchy\&.
517 .sp
518 Takes a boolean argument\&. When true, pages stored in the Zswap cache are permitted to be written to the backing storage, false otherwise\&. Defaults to true\&. 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
519 \m[blue]\fBZswap\fR\m[]\&\s-2\u[6]\d\s+2
520 documentation for more details\&.
521 .sp
522 Added in version 256\&.
523 .RE
524 .PP
525 \fIAllowedMemoryNodes=\fR, \fIStartupAllowedMemoryNodes=\fR
526 .RS 4
527 These settings control the
528 \fBcpuset\fR
529 controller in the unified hierarchy\&.
530 .sp
531 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\&.
532 .sp
533 Setting
534 \fIAllowedMemoryNodes=\fR
535 or
536 \fIStartupAllowedMemoryNodes=\fR
537 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
538 \fIEffectiveMemoryNodes=\fR\&.
539 .sp
540 While
541 \fIStartupAllowedMemoryNodes=\fR
542 applies to the startup and shutdown phases of the system,
543 \fIAllowedMemoryNodes=\fR
544 applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases\&. Using
545 \fIStartupAllowedMemoryNodes=\fR
546 allows prioritizing specific services at boot\-up and shutdown differently than during normal runtime\&.
547 .sp
548 This setting is supported only with the unified control group hierarchy\&.
549 .sp
550 Added in version 244\&.
551 .RE
552 .SS "Process Accounting and Control"
553 .PP
554 \fITasksAccounting=\fR
555 .RS 4
556 This setting controls the
557 \fBpids\fR
558 controller in the unified hierarchy\&.
559 .sp
560 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
561 \fIDefaultTasksAccounting=\fR
562 in
563 \fBsystemd-system.conf\fR(5)\&.
564 .sp
565 Added in version 227\&.
566 .RE
567 .PP
568 \fITasksMax=\fR\fI\fIN\fR\fR
569 .RS 4
570 This setting controls the
571 \fBpids\fR
572 controller in the unified hierarchy\&.
573 .sp
574 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
575 "infinity", no tasks limit is applied\&. This controls the
576 "pids\&.max"
577 control group attribute\&. For details about this control group attribute, see the
578 \m[blue]\fBpids controller\fR\m[]\&\s-2\u[7]\d\s+2\&. The effective configuration is reported as
579 \fIEffectiveTasksMax=\fR\&.
580 .sp
581 The system default for this setting may be controlled with
582 \fIDefaultTasksMax=\fR
583 in
584 \fBsystemd-system.conf\fR(5)\&.
585 .sp
586 Added in version 227\&.
587 .RE
588 .SS "IO Accounting and Control"
589 .PP
590 \fIIOAccounting=\fR
591 .RS 4
592 This setting controls the
593 \fBio\fR
594 controller in the unified hierarchy\&.
595 .sp
596 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
597 \fIDefaultIOAccounting=\fR
598 in
599 \fBsystemd-system.conf\fR(5)\&.
600 .sp
601 Added in version 230\&.
602 .RE
603 .PP
604 \fIIOWeight=\fR\fI\fIweight\fR\fR, \fIStartupIOWeight=\fR\fI\fIweight\fR\fR
605 .RS 4
606 These settings control the
607 \fBio\fR
608 controller in the unified hierarchy\&.
609 .sp
610 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
611 "io\&.weight"
612 control group attribute, which defaults to 100\&. For details about this control group attribute, see
613 \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\&.
614 .sp
615 While
616 \fIStartupIOWeight=\fR
617 applies to the startup and shutdown phases of the system,
618 \fIIOWeight=\fR
619 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\&.
620 .sp
621 Added in version 230\&.
622 .RE
623 .PP
624 \fIIODeviceWeight=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIweight\fR\fR
625 .RS 4
626 This setting controls the
627 \fBio\fR
628 controller in the unified hierarchy\&.
629 .sp
630 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:
631 "/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
632 "io\&.weight"
633 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
634 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
635 .sp
636 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\&.
637 .sp
638 Added in version 230\&.
639 .RE
640 .PP
641 \fIIOReadBandwidthMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR, \fIIOWriteBandwidthMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR
642 .RS 4
643 These settings control the
644 \fBio\fR
645 controller in the unified hierarchy\&.
646 .sp
647 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
648 "io\&.max"
649 control group attributes\&. Use this option multiple times to set bandwidth limits for multiple devices\&. For details about this control group attribute, see
650 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
651 .sp
652 Similar restrictions on block device discovery as for
653 \fIIODeviceWeight=\fR
654 apply, see above\&.
655 .sp
656 Added in version 230\&.
657 .RE
658 .PP
659 \fIIOReadIOPSMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIIOPS\fR\fR, \fIIOWriteIOPSMax=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIIOPS\fR\fR
660 .RS 4
661 These settings control the
662 \fBio\fR
663 controller in the unified hierarchy\&.
664 .sp
665 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
666 "io\&.max"
667 control group attributes\&. Use this option multiple times to set IOPS limits for multiple devices\&. For details about this control group attribute, see
668 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
669 .sp
670 Similar restrictions on block device discovery as for
671 \fIIODeviceWeight=\fR
672 apply, see above\&.
673 .sp
674 Added in version 230\&.
675 .RE
676 .PP
677 \fIIODeviceLatencyTargetSec=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fItarget\fR\fR
678 .RS 4
679 This setting controls the
680 \fBio\fR
681 controller in the unified hierarchy\&.
682 .sp
683 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
684 "io\&.latency"
685 control group attribute\&. Use this option multiple times to set latency target for multiple devices\&. For details about this control group attribute, see
686 \m[blue]\fBIO Interface Files\fR\m[]\&\s-2\u[8]\d\s+2\&.
687 .sp
688 Implies
689 "IOAccounting=yes"\&.
690 .sp
691 These settings are supported only if the unified control group hierarchy is used\&.
692 .sp
693 Similar restrictions on block device discovery as for
694 \fIIODeviceWeight=\fR
695 apply, see above\&.
696 .sp
697 Added in version 240\&.
698 .RE
699 .SS "Network Accounting and Control"
700 .PP
701 \fIIPAccounting=\fR
702 .RS 4
703 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\&.
704 .sp
705 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\&.
706 .sp
707 The system default for this setting may be controlled with
708 \fIDefaultIPAccounting=\fR
709 in
710 \fBsystemd-system.conf\fR(5)\&.
711 .sp
712 Note that this functionality is currently only available for system services, not for per\-user services\&.
713 .sp
714 Added in version 235\&.
715 .RE
716 .PP
717 \fIIPAddressAllow=\fR\fI\fIADDRESS[/PREFIXLENGTH]\&...\fR\fR, \fIIPAddressDeny=\fR\fI\fIADDRESS[/PREFIXLENGTH]\&...\fR\fR
718 .RS 4
719 Turn on network traffic filtering for IP packets sent and received over
720 \fBAF_INET\fR
721 and
722 \fBAF_INET6\fR
723 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
724 "/"
725 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)\&.
726 .sp
727 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:
728 .sp
729 .RS 4
730 .ie n \{\
731 \h'-04'\(bu\h'+03'\c
732 .\}
733 .el \{\
734 .sp -1
735 .IP \(bu 2.3
736 .\}
737 Access is granted when the checked IP address matches an entry in the
738 \fIIPAddressAllow=\fR
739 list\&.
740 .RE
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 Otherwise, access is denied when the checked IP address matches an entry in the
751 \fIIPAddressDeny=\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 granted\&.
764 .RE
765 .sp
766 In order to implement an allow\-listing IP firewall, it is recommended to use a
767 \fIIPAddressDeny=\fR\fBany\fR
768 setting on an upper\-level slice unit (such as the root slice
769 \-\&.slice
770 or the slice containing all system services
771 system\&.slice
772 \(en see
773 \fBsystemd.special\fR(7)
774 for details on these slice units), plus individual per\-service
775 \fIIPAddressAllow=\fR
776 lines permitting network access to relevant services, and only them\&.
777 .sp
778 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\&.
779 .sp
780 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\&.
781 .sp
782 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:
783 .sp
784 .it 1 an-trap
785 .nr an-no-space-flag 1
786 .nr an-break-flag 1
787 .br
788 .B Table\ \&1.\ \&Special address/network names
789 .TS
790 allbox tab(:);
791 lB lB lB.
792 T{
793 Symbolic Name
794 T}:T{
795 Definition
796 T}:T{
797 Meaning
798 T}
799 .T&
800 l l l
801 l l l
802 l l l
803 l l l.
804 T{
805 \fBany\fR
806 T}:T{
807 0\&.0\&.0\&.0/0 ::/0
808 T}:T{
809 Any host
810 T}
811 T{
812 \fBlocalhost\fR
813 T}:T{
814 127\&.0\&.0\&.0/8 ::1/128
815 T}:T{
816 All addresses on the local loopback
817 T}
818 T{
819 \fBlink\-local\fR
820 T}:T{
821 169\&.254\&.0\&.0/16 fe80::/64
822 T}:T{
823 All link\-local IP addresses
824 T}
825 T{
826 \fBmulticast\fR
827 T}:T{
828 224\&.0\&.0\&.0/4 ff00::/8
829 T}:T{
830 All IP multicasting addresses
831 T}
832 .TE
833 .sp 1
834 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\&.
835 .sp
836 This option cannot be bypassed by prefixing
837 "+"
838 to the executable path in the service unit, as it applies to the whole control group\&.
839 .sp
840 Added in version 235\&.
841 .RE
842 .PP
843 \fISocketBindAllow=\fR\fI\fIbind\-rule\fR\fR, \fISocketBindDeny=\fR\fI\fIbind\-rule\fR\fR
844 .RS 4
845 Configures restrictions on the ability of unit processes to invoke
846 \fBbind\fR(2)
847 on a socket\&. Both allow and deny rules to be defined that restrict which addresses a socket may be bound to\&.
848 .sp
849 \fIbind\-rule\fR
850 describes socket properties such as
851 \fIaddress\-family\fR,
852 \fItransport\-protocol\fR
853 and
854 \fIip\-ports\fR\&.
855 .sp
856 \fIbind\-rule\fR
857 := { [\fIaddress\-family\fR\fB:\fR][\fItransport\-protocol\fR\fB:\fR][\fIip\-ports\fR] |
858 \fBany\fR
859 }
860 .sp
861 \fIaddress\-family\fR
862 := {
863 \fBipv4\fR
864 |
865 \fBipv6\fR
866 }
867 .sp
868 \fItransport\-protocol\fR
869 := {
870 \fBtcp\fR
871 |
872 \fBudp\fR
873 }
874 .sp
875 \fIip\-ports\fR
876 := {
877 \fIip\-port\fR
878 |
879 \fIip\-port\-range\fR
880 }
881 .sp
882 An optional
883 \fIaddress\-family\fR
884 expects
885 \fBipv4\fR
886 or
887 \fBipv6\fR
888 values\&. If not specified, a rule will be matched for both IPv4 and IPv6 addresses and applied depending on other socket fields, e\&.g\&.
889 \fItransport\-protocol\fR,
890 \fIip\-port\fR\&.
891 .sp
892 An optional
893 \fItransport\-protocol\fR
894 expects
895 \fBtcp\fR
896 or
897 \fBudp\fR
898 transport protocol names\&. If not specified, a rule will be matched for any transport protocol\&.
899 .sp
900 An optional
901 \fIip\-port\fR
902 value must lie within 1\&...65535 interval inclusively, i\&.e\&. dynamic port
903 \fB0\fR
904 is not allowed\&. A range of sequential ports is described by
905 \fIip\-port\-range\fR
906 :=
907 \fIip\-port\-low\fR\fB\-\fR\fIip\-port\-high\fR, where
908 \fIip\-port\-low\fR
909 is smaller than or equal to
910 \fIip\-port\-high\fR
911 and both are within 1\&...65535 inclusively\&.
912 .sp
913 A special value
914 \fBany\fR
915 can be used to apply a rule to any address family, transport protocol and any port with a positive value\&.
916 .sp
917 To allow multiple rules assign
918 \fISocketBindAllow=\fR
919 or
920 \fISocketBindDeny=\fR
921 multiple times\&. To clear the existing assignments pass an empty
922 \fISocketBindAllow=\fR
923 or
924 \fISocketBindDeny=\fR
925 assignment\&.
926 .sp
927 For each of
928 \fISocketBindAllow=\fR
929 and
930 \fISocketBindDeny=\fR, maximum allowed number of assignments is
931 \fB128\fR\&.
932 .sp
933 .RS 4
934 .ie n \{\
935 \h'-04'\(bu\h'+03'\c
936 .\}
937 .el \{\
938 .sp -1
939 .IP \(bu 2.3
940 .\}
941 Binding to a socket is allowed when a socket address matches an entry in the
942 \fISocketBindAllow=\fR
943 list\&.
944 .RE
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 Otherwise, binding is denied when the socket address matches an entry in the
955 \fISocketBindDeny=\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 allowed\&.
968 .RE
969 .sp
970 The feature is implemented with
971 \fBcgroup/bind4\fR
972 and
973 \fBcgroup/bind6\fR
974 cgroup\-bpf hooks\&.
975 .sp
976 Note that these settings apply to any
977 \fBbind\fR(2)
978 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
979 \fBbind()\fR\&.
980 .sp
981 Examples:
982 .sp
983 .if n \{\
984 .RS 4
985 .\}
986 .nf
987 \&...
988 # Allow binding IPv6 socket addresses with a port greater than or equal to 10000\&.
989 [Service]
990 SocketBindAllow=ipv6:10000\-65535
991 SocketBindDeny=any
992 \&...
993 # Allow binding IPv4 and IPv6 socket addresses with 1234 and 4321 ports\&.
994 [Service]
995 SocketBindAllow=1234
996 SocketBindAllow=4321
997 SocketBindDeny=any
998 \&...
999 # Deny binding IPv6 socket addresses\&.
1000 [Service]
1001 SocketBindDeny=ipv6
1002 \&...
1003 # Deny binding IPv4 and IPv6 socket addresses\&.
1004 [Service]
1005 SocketBindDeny=any
1006 \&...
1007 # Allow binding only over TCP
1008 [Service]
1009 SocketBindAllow=tcp
1010 SocketBindDeny=any
1011 \&...
1012 # Allow binding only over IPv6/TCP
1013 [Service]
1014 SocketBindAllow=ipv6:tcp
1015 SocketBindDeny=any
1016 \&...
1017 # Allow binding ports within 10000\-65535 range over IPv4/UDP\&.
1018 [Service]
1019 SocketBindAllow=ipv4:udp:10000\-65535
1020 SocketBindDeny=any
1021 \&...
1022 .fi
1023 .if n \{\
1024 .RE
1025 .\}
1026 .sp
1027 This option cannot be bypassed by prefixing
1028 "+"
1029 to the executable path in the service unit, as it applies to the whole control group\&.
1030 .sp
1031 Added in version 249\&.
1032 .RE
1033 .PP
1034 \fIRestrictNetworkInterfaces=\fR
1035 .RS 4
1036 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
1037 "~", the effect is inverted: the processes can only use network interfaces not listed (deny\-list)\&.
1038 .sp
1039 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\&.
1040 .sp
1041 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\&.
1042 .sp
1043 The loopback interface ("lo") is not treated in any special way, you have to configure it explicitly in the unit file\&.
1044 .sp
1045 Example 1: allow\-list
1046 .sp
1047 .if n \{\
1048 .RS 4
1049 .\}
1050 .nf
1051 RestrictNetworkInterfaces=eth1
1052 RestrictNetworkInterfaces=eth2
1053 .fi
1054 .if n \{\
1055 .RE
1056 .\}
1057 .sp
1058 Programs in the unit will be only able to use the eth1 and eth2 network interfaces\&.
1059 .sp
1060 Example 2: deny\-list
1061 .sp
1062 .if n \{\
1063 .RS 4
1064 .\}
1065 .nf
1066 RestrictNetworkInterfaces=~eth1 eth2
1067 .fi
1068 .if n \{\
1069 .RE
1070 .\}
1071 .sp
1072 Programs in the unit will be able to use any network interface but eth1 and eth2\&.
1073 .sp
1074 Example 3: mixed
1075 .sp
1076 .if n \{\
1077 .RS 4
1078 .\}
1079 .nf
1080 RestrictNetworkInterfaces=eth1 eth2
1081 RestrictNetworkInterfaces=~eth1
1082 .fi
1083 .if n \{\
1084 .RE
1085 .\}
1086 .sp
1087 Programs in the unit will be only able to use the eth2 network interface\&.
1088 .sp
1089 This option cannot be bypassed by prefixing
1090 "+"
1091 to the executable path in the service unit, as it applies to the whole control group\&.
1092 .sp
1093 Added in version 250\&.
1094 .RE
1095 .PP
1096 \fINFTSet=\fR\fIfamily\fR:\fItable\fR:\fIset\fR
1097 .RS 4
1098 This setting provides a method for integrating dynamic cgroup, user and group IDs into firewall rules with
1099 \m[blue]\fBNFT\fR\m[]\&\s-2\u[9]\d\s+2
1100 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
1101 \fIDynamicUser=\fR
1102 can be also integrated with this setting\&.
1103 .sp
1104 This option expects a whitespace separated list of NFT set definitions\&. Each definition consists of a colon\-separated tuple of source type (one of
1105 "cgroup",
1106 "user"
1107 or
1108 "group"), NFT address family (one of
1109 "arp",
1110 "bridge",
1111 "inet",
1112 "ip",
1113 "ip6", or
1114 "netdev"), table name and set name\&. The names of tables and sets must conform to lexical restrictions of NFT table names\&. The type of the element used in the NFT filter must match the type implied by the directive ("cgroup",
1115 "user"
1116 or
1117 "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\&.
1118 \fBsystemd\fR
1119 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\&.
1120 .sp
1121 .it 1 an-trap
1122 .nr an-no-space-flag 1
1123 .nr an-break-flag 1
1124 .br
1125 .B Table\ \&2.\ \&Defined \fIsource type\fR values
1126 .TS
1127 allbox tab(:);
1128 lB lB lB.
1129 T{
1130 Source type
1131 T}:T{
1132 Description
1133 T}:T{
1134 Corresponding NFT type name
1135 T}
1136 .T&
1137 l l l
1138 l l l
1139 l l l.
1140 T{
1141 "cgroup"
1142 T}:T{
1143 control group ID
1144 T}:T{
1145 "cgroupsv2"
1146 T}
1147 T{
1148 "user"
1149 T}:T{
1150 user ID
1151 T}:T{
1152 "meta skuid"
1153 T}
1154 T{
1155 "group"
1156 T}:T{
1157 group ID
1158 T}:T{
1159 "meta skgid"
1160 T}
1161 .TE
1162 .sp 1
1163 If the firewall rules are reinstalled so that the contents of NFT sets are destroyed, command
1164 \fBsystemctl daemon\-reload\fR
1165 can be used to refill the sets\&.
1166 .sp
1167 Example:
1168 .sp
1169 .if n \{\
1170 .RS 4
1171 .\}
1172 .nf
1173 [Unit]
1174 NFTSet=cgroup:inet:filter:my_service user:inet:filter:serviceuser
1175 .fi
1176 .if n \{\
1177 .RE
1178 .\}
1179 .sp
1180 Corresponding NFT rules:
1181 .sp
1182 .if n \{\
1183 .RS 4
1184 .\}
1185 .nf
1186 table inet filter {
1187 set my_service {
1188 type cgroupsv2
1189 }
1190 set serviceuser {
1191 typeof meta skuid
1192 }
1193 chain x {
1194 socket cgroupv2 level 2 @my_service accept
1195 drop
1196 }
1197 chain y {
1198 meta skuid @serviceuser accept
1199 drop
1200 }
1201 }
1202 .fi
1203 .if n \{\
1204 .RE
1205 .\}
1206 .sp
1207 This option is only available for system services and is not supported for services running in per\-user instances of the service manager\&.
1208 .sp
1209 Added in version 255\&.
1210 .RE
1211 .SS "BPF Programs"
1212 .PP
1213 \fIIPIngressFilterPath=\fR\fI\fIBPF_FS_PROGRAM_PATH\fR\fR, \fIIPEgressFilterPath=\fR\fI\fIBPF_FS_PROGRAM_PATH\fR\fR
1214 .RS 4
1215 Add custom network traffic filters implemented as BPF programs, applying to all IP packets sent and received over
1216 \fBAF_INET\fR
1217 and
1218 \fBAF_INET6\fR
1219 sockets\&. Takes an absolute path to a pinned BPF program in the BPF virtual filesystem (/sys/fs/bpf/)\&.
1220 .sp
1221 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
1222 \fIIPAddressAllow=\fR
1223 and
1224 \fIIPAddressDeny=\fR
1225 filters in any of these units\&. By default, there are no filters specified\&.
1226 .sp
1227 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\&.
1228 .sp
1229 If the path
1230 \fIBPF_FS_PROGRAM_PATH\fR
1231 in
1232 \fIIPIngressFilterPath=\fR
1233 assignment is already being handled by
1234 \fIBPFProgram=\fR
1235 ingress hook, e\&.g\&.
1236 \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
1237 \fIIPEgressFilterPath=\fR
1238 path and
1239 \fBegress\fR
1240 hook\&.
1241 .sp
1242 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\&.
1243 .sp
1244 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 fail the service in that case\&. If compatibility with such systems is desired it is hence recommended to attach your filter manually (requires
1245 \fIDelegate=\fR\fByes\fR) instead of using this setting\&.
1246 .sp
1247 Added in version 243\&.
1248 .RE
1249 .PP
1250 \fIBPFProgram=\fR\fI\fItype\fR\fR\fI:\fR\fI\fIprogram\-path\fR\fR
1251 .RS 4
1252 \fIBPFProgram=\fR
1253 allows attaching custom BPF programs to the cgroup of a unit\&. (This generalizes the functionality exposed via
1254 \fIIPEgressFilterPath=\fR
1255 and
1256 \fIIPIngressFilterPath=\fR
1257 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
1258 \m[blue]\fBbpf\&.h\fR\m[]\&\s-2\u[10]\d\s+2\&. Also refer to the general
1259 \m[blue]\fBBPF documentation\fR\m[]\&\s-2\u[11]\d\s+2\&.
1260 .sp
1261 The specification of BPF program consists of a pair of BPF program type and program path in the file system, with
1262 ":"
1263 as the separator:
1264 \fItype\fR:\fIprogram\-path\fR\&.
1265 .sp
1266 The BPF program type is equivalent to the BPF attach type used in
1267 \fBbpftool\fR(8)
1268 It may be one of
1269 \fBegress\fR,
1270 \fBingress\fR,
1271 \fBsock_create\fR,
1272 \fBsock_ops\fR,
1273 \fBdevice\fR,
1274 \fBbind4\fR,
1275 \fBbind6\fR,
1276 \fBconnect4\fR,
1277 \fBconnect6\fR,
1278 \fBpost_bind4\fR,
1279 \fBpost_bind6\fR,
1280 \fBsendmsg4\fR,
1281 \fBsendmsg6\fR,
1282 \fBsysctl\fR,
1283 \fBrecvmsg4\fR,
1284 \fBrecvmsg6\fR,
1285 \fBgetsockopt\fR, or
1286 \fBsetsockopt\fR\&.
1287 .sp
1288 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
1289 /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)\&.
1290 .sp
1291 Setting
1292 \fIBPFProgram=\fR
1293 to an empty value makes previous assignments ineffective\&.
1294 .sp
1295 Multiple assignments of the same program type/path pair have the same effect as a single assignment: the program will be attached just once\&.
1296 .sp
1297 If BPF
1298 \fBegress\fR
1299 pinned to
1300 \fIprogram\-path\fR
1301 path is already being handled by
1302 \fIIPEgressFilterPath=\fR,
1303 \fIBPFProgram=\fR
1304 assignment will be considered valid and
1305 \fIBPFProgram=\fR
1306 will be attached to a cgroup\&. Similarly for
1307 \fBingress\fR
1308 hook and
1309 \fIIPIngressFilterPath=\fR
1310 assignment\&.
1311 .sp
1312 BPF programs passed with
1313 \fIBPFProgram=\fR
1314 are attached to the cgroup of a unit with BPF attach flag
1315 \fBmulti\fR, that allows further attachments of the same
1316 \fItype\fR
1317 within cgroup hierarchy topped by the unit cgroup\&.
1318 .sp
1319 Examples:
1320 .sp
1321 .if n \{\
1322 .RS 4
1323 .\}
1324 .nf
1325 BPFProgram=egress:/sys/fs/bpf/egress\-hook
1326 BPFProgram=bind6:/sys/fs/bpf/sock\-addr\-hook
1327 .fi
1328 .if n \{\
1329 .RE
1330 .\}
1331 .sp
1332 Added in version 249\&.
1333 .RE
1334 .SS "Device Access"
1335 .PP
1336 \fIDeviceAllow=\fR
1337 .RS 4
1338 Control access to specific device nodes by the executed processes\&. Takes two space\-separated strings: a device node specifier followed by a combination of
1339 \fBr\fR,
1340 \fBw\fR,
1341 \fBm\fR
1342 to control
1343 \fIr\fReading,
1344 \fIw\fRriting, or creation of the specific device nodes by the unit (\fIm\fRknod), respectively\&. This functionality is implemented using eBPF filtering\&.
1345 .sp
1346 When access to
1347 \fIall\fR
1348 physical devices should be disallowed,
1349 \fIPrivateDevices=\fR
1350 may be used instead\&. See
1351 \fBsystemd.exec\fR(5)\&.
1352 .sp
1353 The device node specifier is either a path to a device node in the file system, starting with
1354 /dev/, or a string starting with either
1355 "char\-"
1356 or
1357 "block\-"
1358 followed by a device group name, as listed in
1359 /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
1360 "*"
1361 and
1362 "?"
1363 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
1364 /dev/char/
1365 and
1366 /dev/block/
1367 directories\&. However, matching devices by major/minor is generally not recommended as assignments are neither stable nor portable between systems or different kernel versions\&.
1368 .sp
1369 Examples:
1370 /dev/sda5
1371 is a path to a device node, referring to an ATA or SCSI block device\&.
1372 "char\-pts"
1373 and
1374 "char\-alsa"
1375 are specifiers for all pseudo TTYs and all ALSA sound devices, respectively\&.
1376 "char\-cpu/*"
1377 is a specifier matching all CPU related device groups\&.
1378 .sp
1379 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
1380 \fBAfter=modprobe@xyz\&.service\fR
1381 and
1382 \fBWants=modprobe@xyz\&.service\fR
1383 lines that load the necessary kernel module implementing the device group if missing\&. Example:
1384 .sp
1385 .if n \{\
1386 .RS 4
1387 .\}
1388 .nf
1389 \&...
1390 [Unit]
1391 Wants=modprobe@loop\&.service
1392 After=modprobe@loop\&.service
1393
1394 [Service]
1395 DeviceAllow=block\-loop
1396 DeviceAllow=/dev/loop\-control
1397 \&...
1398 .fi
1399 .if n \{\
1400 .RE
1401 .\}
1402 .sp
1403 This option cannot be bypassed by prefixing
1404 "+"
1405 to the executable path in the service unit, as it applies to the whole control group\&.
1406 .sp
1407 Added in version 208\&.
1408 .RE
1409 .PP
1410 \fIDevicePolicy=auto|closed|strict\fR
1411 .RS 4
1412 Control the policy for allowing device access:
1413 .PP
1414 \fBstrict\fR
1415 .RS 4
1416 means to only allow types of access that are explicitly specified\&.
1417 .sp
1418 Added in version 208\&.
1419 .RE
1420 .PP
1421 \fBclosed\fR
1422 .RS 4
1423 in addition, allows access to standard pseudo devices including
1424 /dev/null,
1425 /dev/zero,
1426 /dev/full,
1427 /dev/random, and
1428 /dev/urandom\&.
1429 .sp
1430 Added in version 208\&.
1431 .RE
1432 .PP
1433 \fBauto\fR
1434 .RS 4
1435 in addition, allows access to all devices if no explicit
1436 \fIDeviceAllow=\fR
1437 is present\&. This is the default\&.
1438 .sp
1439 Added in version 208\&.
1440 .RE
1441 .sp
1442 This option cannot be bypassed by prefixing
1443 "+"
1444 to the executable path in the service unit, as it applies to the whole control group\&.
1445 .sp
1446 Added in version 208\&.
1447 .RE
1448 .SS "Control Group Management"
1449 .PP
1450 \fISlice=\fR
1451 .RS 4
1452 The name of the slice unit to place the unit in\&. Defaults to
1453 system\&.slice
1454 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
1455 system\&.slice
1456 that is named after the template name\&.
1457 .sp
1458 This option may be used to arrange systemd units in a hierarchy of slices each of which might have resource settings applied\&.
1459 .sp
1460 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\&.
1461 .sp
1462 Special care should be taken when relying on the default slice assignment in templated service units that have
1463 \fIDefaultDependencies=no\fR
1464 set, see
1465 \fBsystemd.service\fR(5), section "Default Dependencies" for details\&.
1466 .sp
1467 Added in version 208\&.
1468 .RE
1469 .PP
1470 \fIDelegate=\fR
1471 .RS 4
1472 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
1473 \fIUser=\fR
1474 setting) the unit\*(Aqs control group will be made accessible to the relevant user\&.
1475 .sp
1476 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\&.
1477 .sp
1478 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\&.
1479 .sp
1480 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\&.
1481 .sp
1482 The following controller names may be specified:
1483 \fBcpu\fR,
1484 \fBcpuset\fR,
1485 \fBio\fR,
1486 \fBmemory\fR,
1487 \fBpids\fR,
1488 \fBbpf\-firewall\fR,
1489 \fBbpf\-devices\fR,
1490 \fBbpf\-foreign\fR,
1491 \fBbpf\-socket\-bind\fR, and
1492 \fBbpf\-restrict\-network\-interfaces\fR\&.
1493 .sp
1494 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\&.
1495 .sp
1496 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\&.
1497 .sp
1498 For further details on the delegation model consult
1499 \m[blue]\fBControl Group APIs and Delegation\fR\m[]\&\s-2\u[12]\d\s+2\&.
1500 .sp
1501 Added in version 218\&.
1502 .RE
1503 .PP
1504 \fIDelegateSubgroup=\fR
1505 .RS 4
1506 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\&.
1507 cgroup\&.procs
1508 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
1509 \fIDelegate=\fR, see above\&. Note that this setting only applies to "main" processes of a unit, i\&.e\&. for services to
1510 \fIExecStart=\fR, but not for
1511 \fIExecReload=\fR
1512 and similar\&. If delegation is enabled, the latter are always placed inside a subgroup named
1513 \&.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\&.
1514 .sp
1515 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\&.
1516 .sp
1517 Added in version 254\&.
1518 .RE
1519 .PP
1520 \fIDisableControllers=\fR
1521 .RS 4
1522 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\&.
1523 .sp
1524 Multiple controllers may be specified, separated by spaces\&. You may also pass
1525 \fIDisableControllers=\fR
1526 multiple times, in which case each new instance adds another controller to disable\&. Passing
1527 \fIDisableControllers=\fR
1528 by itself with no controller name present resets the disabled controller list\&.
1529 .sp
1530 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\&.
1531 .sp
1532 The following controller names may be specified:
1533 \fBcpu\fR,
1534 \fBcpuset\fR,
1535 \fBio\fR,
1536 \fBmemory\fR,
1537 \fBpids\fR,
1538 \fBbpf\-firewall\fR,
1539 \fBbpf\-devices\fR,
1540 \fBbpf\-foreign\fR,
1541 \fBbpf\-socket\-bind\fR, and
1542 \fBbpf\-restrict\-network\-interfaces\fR\&.
1543 .sp
1544 Added in version 240\&.
1545 .RE
1546 .SS "Memory Pressure Control"
1547 .PP
1548 \fIManagedOOMSwap=auto|kill\fR, \fIManagedOOMMemoryPressure=auto|kill\fR
1549 .RS 4
1550 Specifies how
1551 \fBsystemd-oomd.service\fR(8)
1552 will act on this unit\*(Aqs cgroups\&. Defaults to
1553 \fBauto\fR\&.
1554 .sp
1555 When set to
1556 \fBkill\fR, the unit becomes a candidate for monitoring by
1557 \fBsystemd\-oomd\fR\&. If the cgroup passes the limits set by
1558 \fBoomd.conf\fR(5)
1559 or the unit configuration,
1560 \fBsystemd\-oomd\fR
1561 will select a descendant cgroup and send
1562 \fBSIGKILL\fR
1563 to all of the processes under it\&. You can find more details on candidates and kill behavior at
1564 \fBsystemd-oomd.service\fR(8)
1565 and
1566 \fBoomd.conf\fR(5)\&.
1567 .sp
1568 Setting either of these properties to
1569 \fBkill\fR
1570 will also result in
1571 \fIAfter=\fR
1572 and
1573 \fIWants=\fR
1574 dependencies on
1575 systemd\-oomd\&.service
1576 unless
1577 \fIDefaultDependencies=no\fR\&.
1578 .sp
1579 When set to
1580 \fBauto\fR,
1581 \fBsystemd\-oomd\fR
1582 will not actively use this cgroup\*(Aqs data for monitoring and detection\&. However, if an ancestor cgroup has one of these properties set to
1583 \fBkill\fR, a unit with
1584 \fBauto\fR
1585 can still be a candidate for
1586 \fBsystemd\-oomd\fR
1587 to terminate\&.
1588 .sp
1589 Added in version 247\&.
1590 .RE
1591 .PP
1592 \fIManagedOOMMemoryPressureLimit=\fR
1593 .RS 4
1594 Overrides the default memory pressure limit set by
1595 \fBoomd.conf\fR(5)
1596 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
1597 \fBoomd.conf\fR(5)\&. This property is ignored unless
1598 \fIManagedOOMMemoryPressure=\fR\fBkill\fR\&.
1599 .sp
1600 Added in version 247\&.
1601 .RE
1602 .PP
1603 \fIManagedOOMMemoryPressureDurationSec=\fR
1604 .RS 4
1605 Overrides the default memory pressure duration set by
1606 \fBoomd.conf\fR(5)
1607 for the cgroup of this unit\&. The specified value supports a time unit such as
1608 "ms"
1609 or
1610 "μs", see
1611 \fBsystemd.time\fR(7)
1612 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
1613 \fBoomd.conf\fR(5)\&. This property is ignored unless
1614 \fIManagedOOMMemoryPressure=\fR\fBkill\fR\&.
1615 .sp
1616 Added in version 257\&.
1617 .RE
1618 .PP
1619 \fIManagedOOMPreference=none|avoid|omit\fR
1620 .RS 4
1621 Allows deprioritizing or omitting this unit\*(Aqs cgroup as a candidate when
1622 \fBsystemd\-oomd\fR
1623 needs to act\&. Requires support for extended attributes (see
1624 \fBxattr\fR(7)) in order to use
1625 \fBavoid\fR
1626 or
1627 \fBomit\fR\&.
1628 .sp
1629 When calculating candidates to relieve swap usage,
1630 \fBsystemd\-oomd\fR
1631 will only respect these extended attributes if the unit\*(Aqs cgroup is owned by root\&.
1632 .sp
1633 When calculating candidates to relieve memory pressure,
1634 \fBsystemd\-oomd\fR
1635 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
1636 \fBsystemd\-oomd\fR
1637 is calculating candidates for
1638 \-\&.slice, then extended attributes set on descendants of
1639 /user\&.slice/user\-1000\&.slice/user@1000\&.service/
1640 will be ignored because the descendants are owned by UID 1000, and
1641 \-\&.slice
1642 is owned by UID 0\&. But, if calculating candidates for
1643 /user\&.slice/user\-1000\&.slice/user@1000\&.service/, then extended attributes set on the descendants would be respected\&.
1644 .sp
1645 If this property is set to
1646 \fBavoid\fR, the service manager will convey this to
1647 \fBsystemd\-oomd\fR, which will only select this cgroup if there are no other viable candidates\&.
1648 .sp
1649 If this property is set to
1650 \fBomit\fR, the service manager will convey this to
1651 \fBsystemd\-oomd\fR, which will ignore this cgroup as a candidate and will not perform any actions on it\&.
1652 .sp
1653 It is recommended to use
1654 \fBavoid\fR
1655 and
1656 \fBomit\fR
1657 sparingly, as it can adversely affect
1658 \fBsystemd\-oomd\fR\*(Aqs kill behavior\&. Also note that these extended attributes are not applied recursively to cgroups under this unit\*(Aqs cgroup\&.
1659 .sp
1660 Defaults to
1661 \fBnone\fR
1662 which means
1663 \fBsystemd\-oomd\fR
1664 will rank this unit\*(Aqs cgroup as defined in
1665 \fBsystemd-oomd.service\fR(8)
1666 and
1667 \fBoomd.conf\fR(5)\&.
1668 .sp
1669 Added in version 248\&.
1670 .RE
1671 .PP
1672 \fIMemoryPressureWatch=\fR
1673 .RS 4
1674 Controls memory pressure monitoring for invoked processes\&. Takes a boolean or one of
1675 "auto"
1676 and
1677 "skip"\&. If
1678 "no", tells the service not to watch for memory pressure events, by setting the
1679 \fI$MEMORY_PRESSURE_WATCH\fR
1680 environment variable to the literal string
1681 /dev/null\&. If
1682 "yes", tells the service to watch for memory pressure events\&. This enables memory accounting for the service, and ensures the
1683 memory\&.pressure
1684 cgroup attribute file is accessible for reading and writing by the service\*(Aqs user\&. It then sets the
1685 \fI$MEMORY_PRESSURE_WATCH\fR
1686 environment variable for processes invoked by the unit to the file system path to this file\&. The threshold information configured with
1687 \fIMemoryPressureThresholdSec=\fR
1688 is encoded in the
1689 \fI$MEMORY_PRESSURE_WRITE\fR
1690 environment variable\&. If the
1691 "auto"
1692 value is set the protocol is enabled if memory accounting is anyway enabled for the unit, and disabled otherwise\&. If set to
1693 "skip"
1694 the logic is neither enabled, nor disabled and the two environment variables are not set\&.
1695 .sp
1696 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
1697 \m[blue]\fBMemory Pressure Handling in systemd\fR\m[]\&\s-2\u[13]\d\s+2\&.
1698 .sp
1699 Services implemented using
1700 \fBsd-event\fR(3)
1701 may use
1702 \fBsd_event_add_memory_pressure\fR(3)
1703 to watch for and handle memory pressure events\&.
1704 .sp
1705 If not explicit set, defaults to the
1706 \fIDefaultMemoryPressureWatch=\fR
1707 setting in
1708 \fBsystemd-system.conf\fR(5)\&.
1709 .sp
1710 Added in version 254\&.
1711 .RE
1712 .PP
1713 \fIMemoryPressureThresholdSec=\fR
1714 .RS 4
1715 Sets the memory pressure threshold time for memory pressure monitor as configured via
1716 \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
1717 \fIDefaultMemoryPressureThresholdSec=\fR
1718 setting in
1719 \fBsystemd-system.conf\fR(5)
1720 (which in turn defaults to 200ms)\&. The specified value expects a time unit such as
1721 "ms"
1722 or
1723 "μs", see
1724 \fBsystemd.time\fR(7)
1725 for details on the permitted syntax\&.
1726 .sp
1727 Added in version 254\&.
1728 .RE
1729 .SS "Coredump Control"
1730 .PP
1731 \fICoredumpReceive=\fR
1732 .RS 4
1733 Takes a boolean argument\&. This setting is used to enable coredump forwarding for containers that belong to this unit\*(Aqs cgroup\&. Units with
1734 \fICoredumpReceive=yes\fR
1735 must also be configured with
1736 \fIDelegate=yes\fR\&. Defaults to false\&.
1737 .sp
1738 When
1739 \fBsystemd\-coredump\fR
1740 is handling a coredump for a process from a container, if the container\*(Aqs leader process is a descendant of a cgroup with
1741 \fICoredumpReceive=yes\fR
1742 and
1743 \fIDelegate=yes\fR, then
1744 \fBsystemd\-coredump\fR
1745 will attempt to forward the coredump to
1746 \fBsystemd\-coredump\fR
1747 within the container\&. See also
1748 \fBsystemd-coredump\fR(8)\&.
1749 .sp
1750 Added in version 255\&.
1751 .RE
1752 .SH "HISTORY"
1753 .PP
1754 systemd 252
1755 .RS 4
1756 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:
1757 \fICPUShares=\fR\fI\fIweight\fR\fR,
1758 \fIStartupCPUShares=\fR\fI\fIweight\fR\fR,
1759 \fIMemoryLimit=\fR\fI\fIbytes\fR\fR,
1760 \fIBlockIOAccounting=\fR,
1761 \fIBlockIOWeight=\fR\fI\fIweight\fR\fR,
1762 \fIStartupBlockIOWeight=\fR\fI\fIweight\fR\fR,
1763 \fIBlockIODeviceWeight=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIweight\fR\fR,
1764 \fIBlockIOReadBandwidth=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR,
1765 \fIBlockIOWriteBandwidth=\fR\fI\fIdevice\fR\fR\fI \fR\fI\fIbytes\fR\fR\&. Please switch to the unified cgroup hierarchy\&.
1766 .RE
1767 .PP
1768 systemd 258
1769 .RS 4
1770 \fICPUAccounting=\fR
1771 setting is deprecated, because it is always available on the unified cgroup hierarchy and such setting has no effect\&.
1772 .RE
1773 .SH "SEE ALSO"
1774 .PP
1775 \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
1776 .SH "NOTES"
1777 .IP " 1." 4
1778 New Control Group Interfaces
1779 .RS 4
1780 \%https://systemd.io/CONTROL_GROUP_INTERFACE
1781 .RE
1782 .IP " 2." 4
1783 Control Groups v2
1784 .RS 4
1785 \%https://docs.kernel.org/admin-guide/cgroup-v2.html
1786 .RE
1787 .IP " 3." 4
1788 CFS Scheduler
1789 .RS 4
1790 \%https://docs.kernel.org/scheduler/sched-design-CFS.html
1791 .RE
1792 .IP " 4." 4
1793 CFS Bandwidth Control
1794 .RS 4
1795 \%https://docs.kernel.org/scheduler/sched-bwc.html
1796 .RE
1797 .IP " 5." 4
1798 Memory Interface Files
1799 .RS 4
1800 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files
1801 .RE
1802 .IP " 6." 4
1803 Zswap
1804 .RS 4
1805 \%https://docs.kernel.org/admin-guide/mm/zswap.html
1806 .RE
1807 .IP " 7." 4
1808 pids controller
1809 .RS 4
1810 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#pid
1811 .RE
1812 .IP " 8." 4
1813 IO Interface Files
1814 .RS 4
1815 \%https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files
1816 .RE
1817 .IP " 9." 4
1818 NFT
1819 .RS 4
1820 \%https://netfilter.org/projects/nftables/index.html
1821 .RE
1822 .IP "10." 4
1823 bpf.h
1824 .RS 4
1825 \%https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf.h
1826 .RE
1827 .IP "11." 4
1828 BPF documentation
1829 .RS 4
1830 \%https://docs.kernel.org/bpf/
1831 .RE
1832 .IP "12." 4
1833 Control Group APIs and Delegation
1834 .RS 4
1835 \%https://systemd.io/CGROUP_DELEGATION
1836 .RE
1837 .IP "13." 4
1838 Memory Pressure Handling in systemd
1839 .RS 4
1840 \%https://systemd.io/MEMORY_PRESSURE
1841 .RE
1842 .IP "14." 4
1843 Control Groups version 1
1844 .RS 4
1845 \%https://docs.kernel.org/admin-guide/cgroup-v1/index.html
1846 .RE