]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.resource-control.xml
Merge pull request #16789 from keszybz/weblate
[thirdparty/systemd.git] / man / systemd.resource-control.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="systemd.resource-control" xmlns:xi="http://www.w3.org/2001/XInclude">
7 <refentryinfo>
8 <title>systemd.resource-control</title>
9 <productname>systemd</productname>
10 </refentryinfo>
11
12 <refmeta>
13 <refentrytitle>systemd.resource-control</refentrytitle>
14 <manvolnum>5</manvolnum>
15 </refmeta>
16
17 <refnamediv>
18 <refname>systemd.resource-control</refname>
19 <refpurpose>Resource control unit settings</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <para>
24 <filename><replaceable>slice</replaceable>.slice</filename>,
25 <filename><replaceable>scope</replaceable>.scope</filename>,
26 <filename><replaceable>service</replaceable>.service</filename>,
27 <filename><replaceable>socket</replaceable>.socket</filename>,
28 <filename><replaceable>mount</replaceable>.mount</filename>,
29 <filename><replaceable>swap</replaceable>.swap</filename>
30 </para>
31 </refsynopsisdiv>
32
33 <refsect1>
34 <title>Description</title>
35
36 <para>Unit configuration files for services, slices, scopes, sockets, mount points, and swap devices share a subset
37 of configuration options for resource control of spawned processes. Internally, this relies on the Linux Control
38 Groups (cgroups) kernel concept for organizing processes in a hierarchical tree of named groups for the purpose of
39 resource management.</para>
40
41 <para>This man page lists the configuration options shared by
42 those six unit types. See
43 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
44 for the common options of all unit configuration files, and
45 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
46 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
47 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
48 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
49 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
50 and
51 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
52 for more information on the specific unit configuration files. The
53 resource control configuration options are configured in the
54 [Slice], [Scope], [Service], [Socket], [Mount], or [Swap]
55 sections, depending on the unit type.</para>
56
57 <para>In addition, options which control resources available to programs
58 <emphasis>executed</emphasis> by systemd are listed in
59 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
60 Those options complement options listed here.</para>
61
62 <para>See the <ulink
63 url="https://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/">New
64 Control Group Interfaces</ulink> for an introduction on how to make
65 use of resource control APIs from programs.</para>
66 </refsect1>
67
68 <refsect1>
69 <title>Implicit Dependencies</title>
70
71 <para>The following dependencies are implicitly added:</para>
72
73 <itemizedlist>
74 <listitem><para>Units with the <varname>Slice=</varname> setting set automatically acquire
75 <varname>Requires=</varname> and <varname>After=</varname> dependencies on the specified
76 slice unit.</para></listitem>
77 </itemizedlist>
78 </refsect1>
79
80 <!-- We don't have any default dependency here. -->
81
82 <refsect1>
83 <title>Unified and Legacy Control Group Hierarchies</title>
84
85 <para>The unified control group hierarchy is the new version of kernel control group interface, see
86 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html">Control Groups v2</ulink>.
87 Depending on the resource type, there are differences in resource control capabilities. Also, because of
88 interface changes, some resource types have separate set of options on the unified hierarchy.</para>
89
90 <para>
91 <variablelist>
92
93 <varlistentry>
94 <term>CPU</term>
95 <listitem>
96 <para><varname>CPUWeight=</varname> and <varname>StartupCPUWeight=</varname> replace
97 <varname>CPUShares=</varname> and <varname>StartupCPUShares=</varname>, respectively.</para>
98
99 <para>The <literal>cpuacct</literal> controller does not exist separately on the unified hierarchy.</para>
100 </listitem>
101 </varlistentry>
102
103 <varlistentry>
104 <term>Memory</term>
105 <listitem>
106 <para><varname>MemoryMax=</varname> replaces <varname>MemoryLimit=</varname>. <varname>MemoryLow=</varname>
107 and <varname>MemoryHigh=</varname> are effective only on unified hierarchy.</para>
108 </listitem>
109 </varlistentry>
110
111 <varlistentry>
112 <term>IO</term>
113 <listitem>
114 <para><literal>IO</literal>-prefixed settings are a superset of and replace
115 <literal>BlockIO</literal>-prefixed ones. On unified hierarchy, IO resource control also applies
116 to buffered writes.</para>
117 </listitem>
118 </varlistentry>
119
120 </variablelist>
121 </para>
122
123 <para>To ease the transition, there is best-effort translation between the two versions of settings. For each
124 controller, if any of the settings for the unified hierarchy are present, all settings for the legacy hierarchy are
125 ignored. If the resulting settings are for the other type of hierarchy, the configurations are translated before
126 application.</para>
127
128 <para>Legacy control group hierarchy (see <ulink
129 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/">Control Groups version 1</ulink>),
130 also called cgroup-v1, doesn't allow safe delegation of controllers to unprivileged processes. If the
131 system uses the legacy control group hierarchy, resource control is disabled for the systemd user
132 instance, see
133 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
134 </refsect1>
135
136 <refsect1>
137 <title>Options</title>
138
139 <para>Units of the types listed above can have settings
140 for resource control configuration:</para>
141
142 <variablelist class='unit-directives'>
143
144 <varlistentry>
145 <term><varname>CPUAccounting=</varname></term>
146
147 <listitem>
148 <para>Turn on CPU usage accounting for this unit. Takes a
149 boolean argument. Note that turning on CPU accounting for
150 one unit will also implicitly turn it on for all units
151 contained in the same slice and for all its parent slices
152 and the units contained therein. The system default for this
153 setting may be controlled with
154 <varname>DefaultCPUAccounting=</varname> in
155 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
156 </listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><varname>CPUWeight=<replaceable>weight</replaceable></varname></term>
161 <term><varname>StartupCPUWeight=<replaceable>weight</replaceable></varname></term>
162
163 <listitem>
164 <para>Assign the specified CPU time weight to the processes executed, if the unified control group hierarchy
165 is used on the system. These options take an integer value and control the <literal>cpu.weight</literal>
166 control group attribute. The allowed range is 1 to 10000. Defaults to 100. For details about this control
167 group attribute, see <ulink
168 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html">Control Groups v2</ulink> and <ulink
169 url="https://www.kernel.org/doc/html/latest/scheduler/sched-design-CFS.html">CFS Scheduler</ulink>.
170 The available CPU time is split up among all units within one slice relative to their CPU time weight.</para>
171
172 <para>While <varname>StartupCPUWeight=</varname> only applies to the startup phase of the system,
173 <varname>CPUWeight=</varname> applies to normal runtime of the system, and if the former is not set also to
174 the startup phase. Using <varname>StartupCPUWeight=</varname> allows prioritizing specific services at
175 boot-up differently than during normal runtime.</para>
176
177 <para>These settings replace <varname>CPUShares=</varname> and <varname>StartupCPUShares=</varname>.</para>
178 </listitem>
179 </varlistentry>
180
181 <varlistentry>
182 <term><varname>CPUQuota=</varname></term>
183
184 <listitem>
185 <para>Assign the specified CPU time quota to the processes executed. Takes a percentage value, suffixed with
186 "%". The percentage specifies how much CPU time the unit shall get at maximum, relative to the total CPU time
187 available on one CPU. Use values &gt; 100% for allotting CPU time on more than one CPU. This controls the
188 <literal>cpu.max</literal> attribute on the unified control group hierarchy and
189 <literal>cpu.cfs_quota_us</literal> on legacy. For details about these control group attributes, see <ulink
190 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html">Control Groups v2</ulink> and <ulink
191 url="https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt">sched-bwc.txt</ulink>.</para>
192
193 <para>Example: <varname>CPUQuota=20%</varname> ensures that the executed processes will never get more than
194 20% CPU time on one CPU.</para>
195
196 </listitem>
197 </varlistentry>
198
199 <varlistentry>
200 <term><varname>CPUQuotaPeriodSec=</varname></term>
201
202 <listitem>
203 <para>Assign the duration over which the CPU time quota specified by <varname>CPUQuota=</varname> is measured.
204 Takes a time duration value in seconds, with an optional suffix such as "ms" for milliseconds (or "s" for seconds.)
205 The default setting is 100ms. The period is clamped to the range supported by the kernel, which is [1ms, 1000ms].
206 Additionally, the period is adjusted up so that the quota interval is also at least 1ms.
207 Setting <varname>CPUQuotaPeriodSec=</varname> to an empty value resets it to the default.</para>
208
209 <para>This controls the second field of <literal>cpu.max</literal> attribute on the unified control group hierarchy
210 and <literal>cpu.cfs_period_us</literal> on legacy. For details about these control group attributes, see
211 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html">Control Groups v2</ulink> and
212 <ulink url="https://www.kernel.org/doc/html/latest/scheduler/sched-design-CFS.html">CFS Scheduler</ulink>.</para>
213
214 <para>Example: <varname>CPUQuotaPeriodSec=10ms</varname> to request that the CPU quota is measured in periods of 10ms.</para>
215 </listitem>
216 </varlistentry>
217
218 <varlistentry>
219 <term><varname>AllowedCPUs=</varname></term>
220
221 <listitem>
222 <para>Restrict processes to be executed on specific CPUs. Takes a list of CPU indices or ranges separated by either
223 whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a dash.</para>
224
225 <para>Setting <varname>AllowedCPUs=</varname> doesn't guarantee that all of the CPUs will be used by the processes
226 as it may be limited by parent units. The effective configuration is reported as <varname>EffectiveCPUs=</varname>.</para>
227
228 <para>This setting is supported only with the unified control group hierarchy.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry>
233 <term><varname>AllowedMemoryNodes=</varname></term>
234
235 <listitem>
236 <para>Restrict processes to be executed on specific memory NUMA nodes. Takes a list of memory NUMA nodes indices
237 or ranges separated by either whitespace or commas. Memory NUMA nodes ranges are specified by the lower and upper
238 CPU indices separated by a dash.</para>
239
240 <para>Setting <varname>AllowedMemoryNodes=</varname> doesn't guarantee that all of the memory NUMA nodes will
241 be used by the processes as it may be limited by parent units. The effective configuration is reported as
242 <varname>EffectiveMemoryNodes=</varname>.</para>
243
244 <para>This setting is supported only with the unified control group hierarchy.</para>
245 </listitem>
246 </varlistentry>
247
248 <varlistentry>
249 <term><varname>MemoryAccounting=</varname></term>
250
251 <listitem>
252 <para>Turn on process and kernel memory accounting for this
253 unit. Takes a boolean argument. Note that turning on memory
254 accounting for one unit will also implicitly turn it on for
255 all units contained in the same slice and for all its parent
256 slices and the units contained therein. The system default
257 for this setting may be controlled with
258 <varname>DefaultMemoryAccounting=</varname> in
259 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
260 </listitem>
261 </varlistentry>
262
263 <varlistentry>
264 <term><varname>MemoryMin=<replaceable>bytes</replaceable></varname>, <varname>MemoryLow=<replaceable>bytes</replaceable></varname></term>
265
266 <listitem>
267 <para>Specify the memory usage protection of the executed processes in this unit.
268 When reclaiming memory, the unit is treated as if it was using less memory resulting in memory
269 to be preferentially reclaimed from unprotected units.
270 Using <varname>MemoryLow=</varname> results in a weaker protection where memory may still
271 be reclaimed to avoid invoking the OOM killer in case there is no other reclaimable memory.</para>
272 <para>
273 For a protection to be effective, it is generally required to set a corresponding
274 allocation on all ancestors, which is then distributed between children
275 (with the exception of the root slice).
276 Any <varname>MemoryMin=</varname> or <varname>MemoryLow=</varname> allocation that is not
277 explicitly distributed to specific children is used to create a shared protection for all children.
278 As this is a shared protection, the children will freely compete for the memory.</para>
279
280 <para>Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
281 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
282 percentage value may be specified, which is taken relative to the installed physical memory on the
283 system. If assigned the special value <literal>infinity</literal>, all available memory is protected, which may be
284 useful in order to always inherit all of the protection afforded by ancestors.
285 This controls the <literal>memory.min</literal> or <literal>memory.low</literal> control group attribute.
286 For details about this control group attribute, see <ulink
287 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
288
289 <para>This setting is supported only if the unified control group hierarchy is used and disables
290 <varname>MemoryLimit=</varname>.</para>
291
292 <para>Units may have their children use a default <literal>memory.min</literal> or
293 <literal>memory.low</literal> value by specifying <varname>DefaultMemoryMin=</varname> or
294 <varname>DefaultMemoryLow=</varname>, which has the same semantics as
295 <varname>MemoryMin=</varname> and <varname>MemoryLow=</varname>.
296 This setting does not affect <literal>memory.min</literal> or <literal>memory.low</literal>
297 in the unit itself.
298 Using it to set a default child allocation is only useful on kernels older than 5.7,
299 which do not support the <literal>memory_recursiveprot</literal> cgroup2 mount option.</para>
300 </listitem>
301 </varlistentry>
302
303 <varlistentry>
304 <term><varname>MemoryHigh=<replaceable>bytes</replaceable></varname></term>
305
306 <listitem>
307 <para>Specify the throttling limit on memory usage of the executed processes in this unit. Memory usage may go
308 above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away
309 aggressively in such cases. This is the main mechanism to control memory usage of a unit.</para>
310
311 <para>Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
312 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
313 percentage value may be specified, which is taken relative to the installed physical memory on the
314 system. If assigned the
315 special value <literal>infinity</literal>, no memory throttling is applied. This controls the
316 <literal>memory.high</literal> control group attribute. For details about this control group attribute, see
317 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
318
319 <para>This setting is supported only if the unified control group hierarchy is used and disables
320 <varname>MemoryLimit=</varname>.</para>
321 </listitem>
322 </varlistentry>
323
324 <varlistentry>
325 <term><varname>MemoryMax=<replaceable>bytes</replaceable></varname></term>
326
327 <listitem>
328 <para>Specify the absolute limit on memory usage of the executed processes in this unit. If memory usage
329 cannot be contained under the limit, out-of-memory killer is invoked inside the unit. It is recommended to
330 use <varname>MemoryHigh=</varname> as the main control mechanism and use <varname>MemoryMax=</varname> as the
331 last line of defense.</para>
332
333 <para>Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
334 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
335 percentage value may be specified, which is taken relative to the installed physical memory on the system. If
336 assigned the special value <literal>infinity</literal>, no memory limit is applied. This controls the
337 <literal>memory.max</literal> control group attribute. For details about this control group attribute, see
338 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
339
340 <para>This setting replaces <varname>MemoryLimit=</varname>.</para>
341 </listitem>
342 </varlistentry>
343
344 <varlistentry>
345 <term><varname>MemorySwapMax=<replaceable>bytes</replaceable></varname></term>
346
347 <listitem>
348 <para>Specify the absolute limit on swap usage of the executed processes in this unit.</para>
349
350 <para>Takes a swap size in bytes. If the value is suffixed with K, M, G or T, the specified swap size is
351 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. If assigned the
352 special value <literal>infinity</literal>, no swap limit is applied. This controls the
353 <literal>memory.swap.max</literal> control group attribute. For details about this control group attribute,
354 see <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
355
356 <para>This setting is supported only if the unified control group hierarchy is used and disables
357 <varname>MemoryLimit=</varname>.</para>
358 </listitem>
359 </varlistentry>
360
361 <varlistentry>
362 <term><varname>TasksAccounting=</varname></term>
363
364 <listitem>
365 <para>Turn on task accounting for this unit. Takes a
366 boolean argument. If enabled, the system manager will keep
367 track of the number of tasks in the unit. The number of
368 tasks accounted this way includes both kernel threads and
369 userspace processes, with each thread counting
370 individually. Note that turning on tasks accounting for one
371 unit will also implicitly turn it on for all units contained
372 in the same slice and for all its parent slices and the
373 units contained therein. The system default for this setting
374 may be controlled with
375 <varname>DefaultTasksAccounting=</varname> in
376 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
377 </listitem>
378 </varlistentry>
379
380 <varlistentry>
381 <term><varname>TasksMax=<replaceable>N</replaceable></varname></term>
382
383 <listitem>
384 <para>Specify the maximum number of tasks that may be created in the unit. This ensures that the number of
385 tasks accounted for the unit (see above) stays below a specific limit. This either takes an absolute number
386 of tasks or a percentage value that is taken relative to the configured maximum number of tasks on the
387 system. If assigned the special value <literal>infinity</literal>, no tasks limit is applied. This controls
388 the <literal>pids.max</literal> control group attribute. For details about this control group attribute, see
389 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/pids.html">Process Number Controller</ulink>.
390 </para>
391
392 <para>The system default for this setting may be controlled with
393 <varname>DefaultTasksMax=</varname> in
394 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
395 </listitem>
396 </varlistentry>
397
398 <varlistentry>
399 <term><varname>IOAccounting=</varname></term>
400
401 <listitem>
402 <para>Turn on Block I/O accounting for this unit, if the unified control group hierarchy is used on the
403 system. Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
404 turn it on for all units contained in the same slice and all for its parent slices and the units contained
405 therein. The system default for this setting may be controlled with <varname>DefaultIOAccounting=</varname>
406 in
407 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
408
409 <para>This setting replaces <varname>BlockIOAccounting=</varname> and disables settings prefixed with
410 <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
411 </listitem>
412 </varlistentry>
413
414 <varlistentry>
415 <term><varname>IOWeight=<replaceable>weight</replaceable></varname></term>
416 <term><varname>StartupIOWeight=<replaceable>weight</replaceable></varname></term>
417
418 <listitem>
419 <para>Set the default overall block I/O weight for the executed processes, if the unified control group
420 hierarchy is used on the system. Takes a single weight value (between 1 and 10000) to set the default block
421 I/O weight. This controls the <literal>io.weight</literal> control group attribute, which defaults to
422 100. For details about this control group attribute, see <ulink
423 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.
424 The available I/O bandwidth is split up among all units within one slice relative to their block
425 I/O weight.</para>
426
427 <para>While <varname>StartupIOWeight=</varname> only applies
428 to the startup phase of the system,
429 <varname>IOWeight=</varname> applies to the later runtime of
430 the system, and if the former is not set also to the startup
431 phase. This allows prioritizing specific services at boot-up
432 differently than during runtime.</para>
433
434 <para>These settings replace <varname>BlockIOWeight=</varname> and <varname>StartupBlockIOWeight=</varname>
435 and disable settings prefixed with <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
436 </listitem>
437 </varlistentry>
438
439 <varlistentry>
440 <term><varname>IODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
441
442 <listitem>
443 <para>Set the per-device overall block I/O weight for the executed processes, if the unified control group
444 hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to specify
445 the device specific weight value, between 1 and 10000. (Example: <literal>/dev/sda 1000</literal>). The file
446 path may be specified as path to a block device node or as any other file, in which case the backing block
447 device of the file system of the file is determined. This controls the <literal>io.weight</literal> control
448 group attribute, which defaults to 100. Use this option multiple times to set weights for multiple devices.
449 For details about this control group attribute, see <ulink
450 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.</para>
451
452 <para>This setting replaces <varname>BlockIODeviceWeight=</varname> and disables settings prefixed with
453 <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
454
455 <para>The specified device node should reference a block device that has an I/O scheduler
456 associated, i.e. should not refer to partition or loopback block devices, but to the originating,
457 physical device. When a path to a regular file or directory is specified it is attempted to
458 discover the correct originating device backing the file system of the specified path. This works
459 correctly only for simpler cases, where the file system is directly placed on a partition or
460 physical block device, or where simple 1:1 encryption using dm-crypt/LUKS is used. This discovery
461 does not cover complex storage and in particular RAID and volume management storage devices.</para>
462 </listitem>
463 </varlistentry>
464
465 <varlistentry>
466 <term><varname>IOReadBandwidthMax=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
467 <term><varname>IOWriteBandwidthMax=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
468
469 <listitem>
470 <para>Set the per-device overall block I/O bandwidth maximum limit for the executed processes, if the unified
471 control group hierarchy is used on the system. This limit is not work-conserving and the executed processes
472 are not allowed to use more even if the device has idle capacity. Takes a space-separated pair of a file
473 path and a bandwidth value (in bytes per second) to specify the device specific bandwidth. The file path may
474 be a path to a block device node, or as any other file in which case the backing block device of the file
475 system of the file is used. If the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is
476 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes, respectively, to the base of 1000. (Example:
477 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the <literal>io.max</literal> control
478 group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For details
479 about this control group attribute, see <ulink
480 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.
481 </para>
482
483 <para>These settings replace <varname>BlockIOReadBandwidth=</varname> and
484 <varname>BlockIOWriteBandwidth=</varname> and disable settings prefixed with <varname>BlockIO</varname> or
485 <varname>StartupBlockIO</varname>.</para>
486
487 <para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para>
488 </listitem>
489 </varlistentry>
490
491 <varlistentry>
492 <term><varname>IOReadIOPSMax=<replaceable>device</replaceable> <replaceable>IOPS</replaceable></varname></term>
493 <term><varname>IOWriteIOPSMax=<replaceable>device</replaceable> <replaceable>IOPS</replaceable></varname></term>
494
495 <listitem>
496 <para>Set the per-device overall block I/O IOs-Per-Second maximum limit for the executed processes, if the
497 unified control group hierarchy is used on the system. This limit is not work-conserving and the executed
498 processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair of
499 a file path and an IOPS value to specify the device specific IOPS. The file path may be a path to a block
500 device node, or as any other file in which case the backing block device of the file system of the file is
501 used. If the IOPS is suffixed with K, M, G, or T, the specified IOPS is parsed as KiloIOPS, MegaIOPS,
502 GigaIOPS, or TeraIOPS, respectively, to the base of 1000. (Example:
503 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 1K"). This controls the <literal>io.max</literal> control
504 group attributes. Use this option multiple times to set IOPS limits for multiple devices. For details about
505 this control group attribute, see <ulink
506 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.
507 </para>
508
509 <para>These settings are supported only if the unified control group hierarchy is used and disable settings
510 prefixed with <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
511
512 <para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para>
513 </listitem>
514 </varlistentry>
515
516 <varlistentry>
517 <term><varname>IODeviceLatencyTargetSec=<replaceable>device</replaceable> <replaceable>target</replaceable></varname></term>
518
519 <listitem>
520 <para>Set the per-device average target I/O latency for the executed processes, if the unified control group
521 hierarchy is used on the system. Takes a file path and a timespan separated by a space to specify
522 the device specific latency target. (Example: "/dev/sda 25ms"). The file path may be specified
523 as path to a block device node or as any other file, in which case the backing block device of the file
524 system of the file is determined. This controls the <literal>io.latency</literal> control group
525 attribute. Use this option multiple times to set latency target for multiple devices. For details about this
526 control group attribute, see <ulink
527 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.</para>
528
529 <para>Implies <literal>IOAccounting=yes</literal>.</para>
530
531 <para>These settings are supported only if the unified control group hierarchy is used.</para>
532
533 <para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para>
534 </listitem>
535 </varlistentry>
536
537 <varlistentry>
538 <term><varname>IPAccounting=</varname></term>
539
540 <listitem>
541 <para>Takes a boolean argument. If true, turns on IPv4 and IPv6 network traffic accounting for packets sent
542 or received by the unit. When this option is turned on, all IPv4 and IPv6 sockets created by any process of
543 the unit are accounted for.</para>
544
545 <para>When this option is used in socket units, it applies to all IPv4 and IPv6 sockets
546 associated with it (including both listening and connection sockets where this applies). Note that for
547 socket-activated services, this configuration setting and the accounting data of the service unit and the
548 socket unit are kept separate, and displayed separately. No propagation of the setting and the collected
549 statistics is done, in either direction. Moreover, any traffic sent or received on any of the socket unit's
550 sockets is accounted to the socket unit — and never to the service unit it might have activated, even if the
551 socket is used by it.</para>
552
553 <para>The system default for this setting may be controlled with <varname>DefaultIPAccounting=</varname> in
554 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
555 </listitem>
556 </varlistentry>
557
558 <varlistentry>
559 <term><varname>IPAddressAllow=<replaceable>ADDRESS[/PREFIXLENGTH]…</replaceable></varname></term>
560 <term><varname>IPAddressDeny=<replaceable>ADDRESS[/PREFIXLENGTH]…</replaceable></varname></term>
561
562 <listitem>
563 <para>Turn on network traffic filtering for IP packets sent and received over
564 <constant>AF_INET</constant> and <constant>AF_INET6</constant> sockets. Both directives take a
565 space separated list of IPv4 or IPv6 addresses, each optionally suffixed with an address prefix
566 length in bits after a <literal>/</literal> character. If the suffix is omitted, the address is
567 considered a host address, i.e. the filter covers the whole address (32 bits for IPv4, 128 bits for
568 IPv6).</para>
569
570 <para>The access lists configured with this option are applied to all sockets created by processes
571 of this unit (or in the case of socket units, associated with it). The lists are implicitly
572 combined with any lists configured for any of the parent slice units this unit might be a member
573 of. By default both access lists are empty. Both ingress and egress traffic is filtered by these
574 settings. In case of ingress traffic the source IP address is checked against these access lists,
575 in case of egress traffic the destination IP address is checked. The following rules are applied in
576 turn:</para>
577
578 <itemizedlist>
579 <listitem><para>Access is granted when the checked IP address matches an entry in the
580 <varname>IPAddressAllow=</varname> list.</para></listitem>
581
582 <listitem><para>Otherwise, access is denied when the checked IP address matches an entry in the
583 <varname>IPAddressDeny=</varname> list.</para></listitem>
584
585 <listitem><para>Otherwise, access is granted.</para></listitem>
586 </itemizedlist>
587
588 <para>In order to implement an allow-listing IP firewall, it is recommended to use a
589 <varname>IPAddressDeny=</varname><constant>any</constant> setting on an upper-level slice unit
590 (such as the root slice <filename>-.slice</filename> or the slice containing all system services
591 <filename>system.slice</filename> – see
592 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>
593 for details on these slice units), plus individual per-service <varname>IPAddressAllow=</varname>
594 lines permitting network access to relevant services, and only them.</para>
595
596 <para>Note that for socket-activated services, the IP access list configured on the socket unit
597 applies to all sockets associated with it directly, but not to any sockets created by the
598 ultimately activated services for it. Conversely, the IP access list configured for the service is
599 not applied to any sockets passed into the service via socket activation. Thus, it is usually a
600 good idea to replicate the IP access lists on both the socket and the service unit. Nevertheless,
601 it may make sense to maintain one list more open and the other one more restricted, depending on
602 the usecase.</para>
603
604 <para>If these settings are used multiple times in the same unit the specified lists are combined. If an
605 empty string is assigned to these settings the specific access list is reset and all previous settings undone.</para>
606
607 <para>In place of explicit IPv4 or IPv6 address and prefix length specifications a small set of symbolic
608 names may be used. The following names are defined:</para>
609
610 <table>
611 <title>Special address/network names</title>
612
613 <tgroup cols='3'>
614 <colspec colname='name'/>
615 <colspec colname='definition'/>
616 <colspec colname='meaning'/>
617
618 <thead>
619 <row>
620 <entry>Symbolic Name</entry>
621 <entry>Definition</entry>
622 <entry>Meaning</entry>
623 </row>
624 </thead>
625
626 <tbody>
627 <row>
628 <entry><constant>any</constant></entry>
629 <entry>0.0.0.0/0 ::/0</entry>
630 <entry>Any host</entry>
631 </row>
632
633 <row>
634 <entry><constant>localhost</constant></entry>
635 <entry>127.0.0.0/8 ::1/128</entry>
636 <entry>All addresses on the local loopback</entry>
637 </row>
638
639 <row>
640 <entry><constant>link-local</constant></entry>
641 <entry>169.254.0.0/16 fe80::/64</entry>
642 <entry>All link-local IP addresses</entry>
643 </row>
644
645 <row>
646 <entry><constant>multicast</constant></entry>
647 <entry>224.0.0.0/4 ff00::/8</entry>
648 <entry>All IP multicasting addresses</entry>
649 </row>
650 </tbody>
651 </tgroup>
652 </table>
653
654 <para>Note that these settings might not be supported on some systems (for example if eBPF control group
655 support is not enabled in the underlying kernel or container manager). These settings will have no effect in
656 that case. If compatibility with such systems is desired it is hence recommended to not exclusively rely on
657 them for IP security.</para>
658 </listitem>
659 </varlistentry>
660
661 <varlistentry>
662 <term><varname>IPIngressFilterPath=<replaceable>BPF_FS_PROGRAM_PATH</replaceable></varname></term>
663 <term><varname>IPEgressFilterPath=<replaceable>BPF_FS_PROGRAM_PATH</replaceable></varname></term>
664
665 <listitem>
666 <para>Add custom network traffic filters implemented as BPF programs, applying to all IP packets
667 sent and received over <constant>AF_INET</constant> and <constant>AF_INET6</constant> sockets.
668 Takes an absolute path to a pinned BPF program in the BPF virtual filesystem (<filename>/sys/fs/bpf/</filename>).
669 </para>
670
671 <para>The filters configured with this option are applied to all sockets created by processes
672 of this unit (or in the case of socket units, associated with it). The filters are loaded in addition
673 to filters any of the parent slice units this unit might be a member of as well as any
674 <varname>IPAddressAllow=</varname> and <varname>IPAddressDeny=</varname> filters in any of these units.
675 By default there are no filters specified.</para>
676
677 <para>If these settings are used multiple times in the same unit all the specified programs are attached. If an
678 empty string is assigned to these settings the program list is reset and all previous specified programs ignored.</para>
679
680 <para>Note that for socket-activated services, the IP filter programs configured on the socket unit apply to
681 all sockets associated with it directly, but not to any sockets created by the ultimately activated services
682 for it. Conversely, the IP filter programs configured for the service are not applied to any sockets passed into
683 the service via socket activation. Thus, it is usually a good idea, to replicate the IP filter programs on both
684 the socket and the service unit, however it often makes sense to maintain one configuration more open and the other
685 one more restricted, depending on the usecase.</para>
686
687 <para>Note that these settings might not be supported on some systems (for example if eBPF control group
688 support is not enabled in the underlying kernel or container manager). These settings will fail the service in
689 that case. If compatibility with such systems is desired it is hence recommended to attach your filter manually
690 (requires <varname>Delegate=</varname><constant>yes</constant>) instead of using this setting.</para>
691 </listitem>
692 </varlistentry>
693
694 <varlistentry>
695 <term><varname>DeviceAllow=</varname></term>
696
697 <listitem>
698 <para>Control access to specific device nodes by the executed processes. Takes two space-separated
699 strings: a device node specifier followed by a combination of <constant>r</constant>,
700 <constant>w</constant>, <constant>m</constant> to control <emphasis>r</emphasis>eading,
701 <emphasis>w</emphasis>riting, or creation of the specific device node(s) by the unit
702 (<emphasis>m</emphasis>knod), respectively. On cgroup-v1 this controls the
703 <literal>devices.allow</literal> control group attribute. For details about this control group
704 attribute, see <ulink
705 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/devices.html">Device Whitelist Controller</ulink>.
706 In the unified cgroup hierarchy this functionality is implemented using eBPF filtering.</para>
707
708 <para>The device node specifier is either a path to a device node in the file system, starting with
709 <filename>/dev/</filename>, or a string starting with either <literal>char-</literal> or
710 <literal>block-</literal> followed by a device group name, as listed in
711 <filename>/proc/devices</filename>. The latter is useful to allow-list all current and future
712 devices belonging to a specific device group at once. The device group is matched according to
713 filename globbing rules, you may hence use the <literal>*</literal> and <literal>?</literal>
714 wildcards. (Note that such globbing wildcards are not available for device node path
715 specifications!) In order to match device nodes by numeric major/minor, use device node paths in
716 the <filename>/dev/char/</filename> and <filename>/dev/block/</filename> directories. However,
717 matching devices by major/minor is generally not recommended as assignments are neither stable nor
718 portable between systems or different kernel versions.</para>
719
720 <para>Examples: <filename>/dev/sda5</filename> is a path to a device node, referring to an ATA or
721 SCSI block device. <literal>char-pts</literal> and <literal>char-alsa</literal> are specifiers for
722 all pseudo TTYs and all ALSA sound devices, respectively. <literal>char-cpu/*</literal> is a
723 specifier matching all CPU related device groups.</para>
724
725 <para>Note that allow lists defined this way should only reference device groups which are
726 resolvable at the time the unit is started. Any device groups not resolvable then are not added to
727 the device allow list. In order to work around this limitation, consider extending service units
728 with a pair of <command>After=modprobe@xyz.service</command> and
729 <command>Wants=modprobe@xyz.service</command> lines that load the necessary kernel module
730 implementing the device group if missing.
731 Example: <programlisting>…
732 [Unit]
733 Wants=modprobe@loop.service
734 After=modprobe@loop.service
735
736 [Service]
737 DeviceAllow=block-loop
738 DeviceAllow=/dev/loop-control
739 …</programlisting></para>
740
741 </listitem>
742 </varlistentry>
743
744 <varlistentry>
745 <term><varname>DevicePolicy=auto|closed|strict</varname></term>
746
747 <listitem>
748 <para>
749 Control the policy for allowing device access:
750 </para>
751 <variablelist>
752 <varlistentry>
753 <term><option>strict</option></term>
754 <listitem>
755 <para>means to only allow types of access that are
756 explicitly specified.</para>
757 </listitem>
758 </varlistentry>
759
760 <varlistentry>
761 <term><option>closed</option></term>
762 <listitem>
763 <para>in addition, allows access to standard pseudo
764 devices including
765 <filename>/dev/null</filename>,
766 <filename>/dev/zero</filename>,
767 <filename>/dev/full</filename>,
768 <filename>/dev/random</filename>, and
769 <filename>/dev/urandom</filename>.
770 </para>
771 </listitem>
772 </varlistentry>
773
774 <varlistentry>
775 <term><option>auto</option></term>
776 <listitem>
777 <para>
778 in addition, allows access to all devices if no
779 explicit <varname>DeviceAllow=</varname> is present.
780 This is the default.
781 </para>
782 </listitem>
783 </varlistentry>
784 </variablelist>
785 </listitem>
786 </varlistentry>
787
788 <varlistentry>
789 <term><varname>Slice=</varname></term>
790
791 <listitem>
792 <para>The name of the slice unit to place the unit
793 in. Defaults to <filename>system.slice</filename> for all
794 non-instantiated units of all unit types (except for slice
795 units themselves see below). Instance units are by default
796 placed in a subslice of <filename>system.slice</filename>
797 that is named after the template name.</para>
798
799 <para>This option may be used to arrange systemd units in a
800 hierarchy of slices each of which might have resource
801 settings applied.</para>
802
803 <para>For units of type slice, the only accepted value for
804 this setting is the parent slice. Since the name of a slice
805 unit implies the parent slice, it is hence redundant to ever
806 set this parameter directly for slice units.</para>
807
808 <para>Special care should be taken when relying on the default slice assignment in templated service units
809 that have <varname>DefaultDependencies=no</varname> set, see
810 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, section
811 "Default Dependencies" for details.</para>
812
813 </listitem>
814 </varlistentry>
815
816 <varlistentry>
817 <term><varname>Delegate=</varname></term>
818
819 <listitem>
820 <para>Turns on delegation of further resource control partitioning to processes of the unit. Units where this
821 is enabled may create and manage their own private subhierarchy of control groups below the control group of
822 the unit itself. For unprivileged services (i.e. those using the <varname>User=</varname> setting) the unit's
823 control group will be made accessible to the relevant user. When enabled the service manager will refrain
824 from manipulating control groups or moving processes below the unit's control group, so that a clear concept
825 of ownership is established: the control group tree above the unit's control group (i.e. towards the root
826 control group) is owned and managed by the service manager of the host, while the control group tree below
827 the unit's control group is owned and managed by the unit itself. Takes either a boolean argument or a list
828 of control group controller names. If true, delegation is turned on, and all supported controllers are
829 enabled for the unit, making them available to the unit's processes for management. If false, delegation is
830 turned off entirely (and no additional controllers are enabled). If set to a list of controllers, delegation
831 is turned on, and the specified controllers are enabled for the unit. Note that additional controllers than
832 the ones specified might be made available as well, depending on configuration of the containing slice unit
833 or other units contained in it. Note that assigning the empty string will enable delegation, but reset the
834 list of controllers, all assignments prior to this will have no effect. Defaults to false.</para>
835
836 <para>Note that controller delegation to less privileged code is only safe on the unified control group
837 hierarchy. Accordingly, access to the specified controllers will not be granted to unprivileged services on
838 the legacy hierarchy, even when requested.</para>
839
840 <xi:include href="supported-controllers.xml" xpointer="controllers-text" />
841
842 <para>Not all of these controllers are available on all kernels however, and some are
843 specific to the unified hierarchy while others are specific to the legacy hierarchy. Also note that the
844 kernel might support further controllers, which aren't covered here yet as delegation is either not supported
845 at all for them or not defined cleanly.</para>
846
847 <para>For further details on the delegation model consult <ulink
848 url="https://systemd.io/CGROUP_DELEGATION">Control Group APIs and Delegation</ulink>.</para>
849 </listitem>
850 </varlistentry>
851
852 <varlistentry>
853 <term><varname>DisableControllers=</varname></term>
854
855 <listitem>
856 <para>Disables controllers from being enabled for a unit's children. If a controller listed is already in use
857 in its subtree, the controller will be removed from the subtree. This can be used to avoid child units being
858 able to implicitly or explicitly enable a controller. Defaults to not disabling any controllers.</para>
859
860 <para>It may not be possible to successfully disable a controller if the unit or any child of the unit in
861 question delegates controllers to its children, as any delegated subtree of the cgroup hierarchy is unmanaged
862 by systemd.</para>
863
864 <para>Multiple controllers may be specified, separated by spaces. You may also pass
865 <varname>DisableControllers=</varname> multiple times, in which case each new instance adds another controller
866 to disable. Passing <varname>DisableControllers=</varname> by itself with no controller name present resets
867 the disabled controller list.</para>
868
869 <xi:include href="supported-controllers.xml" xpointer="controllers-text" />
870 </listitem>
871 </varlistentry>
872 </variablelist>
873 </refsect1>
874
875 <refsect1>
876 <title>Deprecated Options</title>
877
878 <para>The following options are deprecated. Use the indicated superseding options instead:</para>
879
880 <variablelist class='unit-directives'>
881
882 <varlistentry>
883 <term><varname>CPUShares=<replaceable>weight</replaceable></varname></term>
884 <term><varname>StartupCPUShares=<replaceable>weight</replaceable></varname></term>
885
886 <listitem>
887 <para>Assign the specified CPU time share weight to the processes executed. These options take an integer
888 value and control the <literal>cpu.shares</literal> control group attribute. The allowed range is 2 to
889 262144. Defaults to 1024. For details about this control group attribute, see <ulink
890 url="https://www.kernel.org/doc/html/latest/scheduler/sched-design-CFS.html">CFS Scheduler</ulink>.
891 The available CPU time is split up among all units within one slice relative to their CPU time share
892 weight.</para>
893
894 <para>While <varname>StartupCPUShares=</varname> only applies to the startup phase of the system,
895 <varname>CPUShares=</varname> applies to normal runtime of the system, and if the former is not set also to
896 the startup phase. Using <varname>StartupCPUShares=</varname> allows prioritizing specific services at
897 boot-up differently than during normal runtime.</para>
898
899 <para>Implies <literal>CPUAccounting=yes</literal>.</para>
900
901 <para>These settings are deprecated. Use <varname>CPUWeight=</varname> and
902 <varname>StartupCPUWeight=</varname> instead.</para>
903 </listitem>
904 </varlistentry>
905
906 <varlistentry>
907 <term><varname>MemoryLimit=<replaceable>bytes</replaceable></varname></term>
908
909 <listitem>
910 <para>Specify the limit on maximum memory usage of the executed processes. The limit specifies how much
911 process and kernel memory can be used by tasks in this unit. Takes a memory size in bytes. If the value is
912 suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or
913 Terabytes (with the base 1024), respectively. Alternatively, a percentage value may be specified, which is
914 taken relative to the installed physical memory on the system. If assigned the special value
915 <literal>infinity</literal>, no memory limit is applied. This controls the
916 <literal>memory.limit_in_bytes</literal> control group attribute. For details about this control group
917 attribute, see <ulink
918 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/memory.html">Memory Resource Controller</ulink>.</para>
919
920 <para>Implies <literal>MemoryAccounting=yes</literal>.</para>
921
922 <para>This setting is deprecated. Use <varname>MemoryMax=</varname> instead.</para>
923 </listitem>
924 </varlistentry>
925
926 <varlistentry>
927 <term><varname>BlockIOAccounting=</varname></term>
928
929 <listitem>
930 <para>Turn on Block I/O accounting for this unit, if the legacy control group hierarchy is used on the
931 system. Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
932 turn it on for all units contained in the same slice and all for its parent slices and the units contained
933 therein. The system default for this setting may be controlled with
934 <varname>DefaultBlockIOAccounting=</varname> in
935 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
936
937 <para>This setting is deprecated. Use <varname>IOAccounting=</varname> instead.</para>
938 </listitem>
939 </varlistentry>
940
941 <varlistentry>
942 <term><varname>BlockIOWeight=<replaceable>weight</replaceable></varname></term>
943 <term><varname>StartupBlockIOWeight=<replaceable>weight</replaceable></varname></term>
944
945 <listitem><para>Set the default overall block I/O weight for the executed processes, if the legacy control
946 group hierarchy is used on the system. Takes a single weight value (between 10 and 1000) to set the default
947 block I/O weight. This controls the <literal>blkio.weight</literal> control group attribute, which defaults to
948 500. For details about this control group attribute, see <ulink
949 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.
950 The available I/O bandwidth is split up among all units within one slice relative to their block I/O
951 weight.</para>
952
953 <para>While <varname>StartupBlockIOWeight=</varname> only
954 applies to the startup phase of the system,
955 <varname>BlockIOWeight=</varname> applies to the later runtime
956 of the system, and if the former is not set also to the
957 startup phase. This allows prioritizing specific services at
958 boot-up differently than during runtime.</para>
959
960 <para>Implies
961 <literal>BlockIOAccounting=yes</literal>.</para>
962
963 <para>These settings are deprecated. Use <varname>IOWeight=</varname> and <varname>StartupIOWeight=</varname>
964 instead.</para>
965
966 </listitem>
967 </varlistentry>
968
969 <varlistentry>
970 <term><varname>BlockIODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
971
972 <listitem>
973 <para>Set the per-device overall block I/O weight for the executed processes, if the legacy control group
974 hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to specify
975 the device specific weight value, between 10 and 1000. (Example: "/dev/sda 500"). The file path may be
976 specified as path to a block device node or as any other file, in which case the backing block device of the
977 file system of the file is determined. This controls the <literal>blkio.weight_device</literal> control group
978 attribute, which defaults to 1000. Use this option multiple times to set weights for multiple devices. For
979 details about this control group attribute, see <ulink
980 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.</para>
981
982 <para>Implies
983 <literal>BlockIOAccounting=yes</literal>.</para>
984
985 <para>This setting is deprecated. Use <varname>IODeviceWeight=</varname> instead.</para>
986 </listitem>
987 </varlistentry>
988
989 <varlistentry>
990 <term><varname>BlockIOReadBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
991 <term><varname>BlockIOWriteBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
992
993 <listitem>
994 <para>Set the per-device overall block I/O bandwidth limit for the executed processes, if the legacy control
995 group hierarchy is used on the system. Takes a space-separated pair of a file path and a bandwidth value (in
996 bytes per second) to specify the device specific bandwidth. The file path may be a path to a block device
997 node, or as any other file in which case the backing block device of the file system of the file is used. If
998 the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is parsed as Kilobytes, Megabytes,
999 Gigabytes, or Terabytes, respectively, to the base of 1000. (Example:
1000 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the
1001 <literal>blkio.throttle.read_bps_device</literal> and <literal>blkio.throttle.write_bps_device</literal>
1002 control group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For
1003 details about these control group attributes, see <ulink
1004 url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.
1005 </para>
1006
1007 <para>Implies
1008 <literal>BlockIOAccounting=yes</literal>.</para>
1009
1010 <para>These settings are deprecated. Use <varname>IOReadBandwidthMax=</varname> and
1011 <varname>IOWriteBandwidthMax=</varname> instead.</para>
1012 </listitem>
1013 </varlistentry>
1014
1015 </variablelist>
1016 </refsect1>
1017
1018 <refsect1>
1019 <title>See Also</title>
1020 <para>
1021 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1022 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1023 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1024 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1025 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1026 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1027 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1028 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1029 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1030 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1031 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1032 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1033 The documentation for control groups and specific controllers in the Linux kernel:
1034 <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html">Control Groups v2</ulink>.
1035 </para>
1036 </refsect1>
1037 </refentry>