Debian Codegraph @

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

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