Debian Codegraph @

upstream/opensuse-tumbleweed/man5/systemd.resource-control.5

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