]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.resource-control.xml
Merge pull request 3821 from davide125/fix-tests
[thirdparty/systemd.git] / man / systemd.resource-control.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2013 Zbigniew Jędrzejewski-Szmek
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.resource-control">
25 <refentryinfo>
26 <title>systemd.resource-control</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>systemd.resource-control</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>systemd.resource-control</refname>
46 <refpurpose>Resource control unit settings</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para>
51 <filename><replaceable>slice</replaceable>.slice</filename>,
52 <filename><replaceable>scope</replaceable>.scope</filename>,
53 <filename><replaceable>service</replaceable>.service</filename>,
54 <filename><replaceable>socket</replaceable>.socket</filename>,
55 <filename><replaceable>mount</replaceable>.mount</filename>,
56 <filename><replaceable>swap</replaceable>.swap</filename>
57 </para>
58 </refsynopsisdiv>
59
60 <refsect1>
61 <title>Description</title>
62
63 <para>Unit configuration files for services, slices, scopes,
64 sockets, mount points, and swap devices share a subset of
65 configuration options for resource control of spawned
66 processes. Internally, this relies on the Control Groups
67 kernel concept for organizing processes in a hierarchical tree of
68 named groups for the purpose of resource management.</para>
69
70 <para>This man page lists the configuration options shared by
71 those six unit types. See
72 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
73 for the common options of all unit configuration files, and
74 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
75 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
76 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
77 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
78 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
79 and
80 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
81 for more information on the specific unit configuration files. The
82 resource control configuration options are configured in the
83 [Slice], [Scope], [Service], [Socket], [Mount], or [Swap]
84 sections, depending on the unit type.</para>
85
86 <para>See the <ulink
87 url="http://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/">New
88 Control Group Interfaces</ulink> for an introduction on how to make
89 use of resource control APIs from programs.</para>
90 </refsect1>
91
92 <refsect1>
93 <title>Automatic Dependencies</title>
94
95 <para>Units with the <varname>Slice=</varname> setting set automatically acquire <varname>Requires=</varname> and
96 <varname>After=</varname> dependencies on the specified slice unit.</para>
97 </refsect1>
98
99 <refsect1>
100 <title>Unified and Legacy Control Group Hierarchies</title>
101
102 <para>The unified control group hierarchy is the new version of kernel control group interface, see <ulink
103 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>. Depending on the resource type,
104 there are differences in resource control capabilities. Also, because of interface changes, some resource types
105 have separate set of options on the unified hierarchy.</para>
106
107 <para>
108 <variablelist>
109 <varlistentry>
110 <term><option>IO</option></term>
111 <listitem>
112 <para><varname>IO</varname> prefixed settings are superset of and replace <varname>BlockIO</varname>
113 prefixed ones. On unified hierarchy, IO resource control also applies to buffered writes.</para>
114 </listitem>
115 </varlistentry>
116 <varlistentry>
117 <term><option>Memory</option></term>
118 <listitem>
119 <para><varname>MemoryMax=</varname> replaces <varname>MemoryLimit=</varname>. <varname>MemoryLow=</varname>
120 and <varname>MemoryHigh=</varname> are effective only on unified hierarchy.</para>
121 </listitem>
122 </varlistentry>
123 </variablelist>
124 </para>
125
126 <para>To ease the transition, there is best-effort translation between the two versions of settings. If all
127 settings of a unit for a given resource type are for the other hierarchy type, the settings are translated and
128 applied. If there are any valid settings for the hierarchy in use, all translations are disabled for the resource
129 type. Mixing the two types of settings on a unit can lead to confusing results.</para>
130
131 <para>Legacy control group hierarchy (see <ulink
132 url="https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt">cgroups.txt</ulink>), also called cgroup-v1,
133 doesn't allow safe delegation of controllers to unprivileged processes. If the system uses the legacy control group
134 hierarchy, resource control is disabled for systemd user instance, see
135 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
136 </para>
137 </refsect1>
138
139 <refsect1>
140 <title>Options</title>
141
142 <para>Units of the types listed above can have settings
143 for resource control configuration:</para>
144
145 <variablelist class='unit-directives'>
146
147 <varlistentry>
148 <term><varname>CPUAccounting=</varname></term>
149
150 <listitem>
151 <para>Turn on CPU usage accounting for this unit. Takes a
152 boolean argument. Note that turning on CPU accounting for
153 one unit will also implicitly turn it on for all units
154 contained in the same slice and for all its parent slices
155 and the units contained therein. The system default for this
156 setting may be controlled with
157 <varname>DefaultCPUAccounting=</varname> in
158 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
159 </listitem>
160 </varlistentry>
161
162 <varlistentry>
163 <term><varname>CPUShares=<replaceable>weight</replaceable></varname></term>
164 <term><varname>StartupCPUShares=<replaceable>weight</replaceable></varname></term>
165
166 <listitem>
167 <para>Assign the specified CPU time share weight to the
168 processes executed. These options take an integer value and
169 control the <literal>cpu.shares</literal> control group
170 attribute. The allowed range is 2 to 262144. Defaults to
171 1024. For details about this control group attribute, see
172 <ulink
173 url="https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">sched-design-CFS.txt</ulink>.
174 The available CPU time is split up among all units within
175 one slice relative to their CPU time share weight.</para>
176
177 <para>While <varname>StartupCPUShares=</varname> only
178 applies to the startup phase of the system,
179 <varname>CPUShares=</varname> applies to normal runtime of
180 the system, and if the former is not set also to the startup
181 phase. Using <varname>StartupCPUShares=</varname> allows
182 prioritizing specific services at boot-up differently than
183 during normal runtime.</para>
184
185 <para>These options imply
186 <literal>CPUAccounting=true</literal>.</para>
187 </listitem>
188 </varlistentry>
189
190 <varlistentry>
191 <term><varname>CPUQuota=</varname></term>
192
193 <listitem>
194 <para>Assign the specified CPU time quota to the processes
195 executed. Takes a percentage value, suffixed with "%". The
196 percentage specifies how much CPU time the unit shall get at
197 maximum, relative to the total CPU time available on one
198 CPU. Use values &gt; 100% for allotting CPU time on more than
199 one CPU. This controls the
200 <literal>cpu.cfs_quota_us</literal> control group
201 attribute. For details about this control group attribute,
202 see <ulink
203 url="https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">sched-design-CFS.txt</ulink>.</para>
204
205 <para>Example: <varname>CPUQuota=20%</varname> ensures that
206 the executed processes will never get more than 20% CPU time
207 on one CPU.</para>
208
209 <para>Implies <literal>CPUAccounting=true</literal>.</para>
210 </listitem>
211 </varlistentry>
212
213 <varlistentry>
214 <term><varname>MemoryAccounting=</varname></term>
215
216 <listitem>
217 <para>Turn on process and kernel memory accounting for this
218 unit. Takes a boolean argument. Note that turning on memory
219 accounting for one unit will also implicitly turn it on for
220 all units contained in the same slice and for all its parent
221 slices and the units contained therein. The system default
222 for this setting may be controlled with
223 <varname>DefaultMemoryAccounting=</varname> in
224 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
225 </listitem>
226 </varlistentry>
227
228 <varlistentry>
229 <term><varname>MemoryLow=<replaceable>bytes</replaceable></varname></term>
230
231 <listitem>
232 <para>Specify the best-effort memory usage protection of the executed processes in this unit. If the memory
233 usages of this unit and all its ancestors are below their low boundaries, this unit's memory won't be
234 reclaimed as long as memory can be reclaimed from unprotected units.</para>
235
236 <para>Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
237 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
238 percentage value may be specified, which is taken relative to the installed physical memory on the
239 system. This controls the <literal>memory.low</literal> control group attribute. For details about this
240 control group attribute, see <ulink
241 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.</para>
242
243 <para>Implies <literal>MemoryAccounting=true</literal>.</para>
244
245 <para>This setting is supported only if the unified control group hierarchy is used.</para>
246 </listitem>
247 </varlistentry>
248
249 <varlistentry>
250 <term><varname>MemoryHigh=<replaceable>bytes</replaceable></varname></term>
251
252 <listitem>
253 <para>Specify the high limit on memory usage of the executed processes in this unit. Memory usage may go
254 above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away
255 aggressively in such cases. This is the main mechanism to control memory usage of a unit.</para>
256
257 <para>Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
258 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
259 percentage value may be specified, which is taken relative to the installed physical memory on the
260 system. If assigned the
261 special value <literal>infinity</literal>, no memory limit is applied. This controls the
262 <literal>memory.high</literal> control group attribute. For details about this control group attribute, see
263 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.</para>
264
265 <para>Implies <literal>MemoryAccounting=true</literal>.</para>
266
267 <para>This setting is supported only if the unified control group hierarchy is used.</para>
268 </listitem>
269 </varlistentry>
270
271 <varlistentry>
272 <term><varname>MemoryMax=<replaceable>bytes</replaceable></varname></term>
273
274 <listitem>
275 <para>Specify the absolute limit on memory usage of the executed processes in this unit. If memory usage
276 cannot be contained under the limit, out-of-memory killer is invoked inside the unit. It is recommended to
277 use <varname>MemoryHigh=</varname> as the main control mechanism and use <varname>MemoryMax=</varname> as the
278 last line of defense.</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 system. If
283 assigned the special value <literal>infinity</literal>, no memory limit is applied. This controls the
284 <literal>memory.max</literal> control group attribute. For details about this control group attribute, see
285 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.</para>
286
287 <para>Implies <literal>MemoryAccounting=true</literal>.</para>
288
289 <para>This setting is supported only if the unified control group hierarchy is used. Use
290 <varname>MemoryLimit=</varname> on systems using the legacy control group hierarchy.</para>
291 </listitem>
292 </varlistentry>
293
294 <varlistentry>
295 <term><varname>MemoryLimit=<replaceable>bytes</replaceable></varname></term>
296
297 <listitem>
298 <para>Specify the limit on maximum memory usage of the executed processes. The limit specifies how much
299 process and kernel memory can be used by tasks in this unit. Takes a memory size in bytes. If the value is
300 suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or
301 Terabytes (with the base 1024), respectively. Alternatively, a percentage value may be specified, which is
302 taken relative to the installed physical memory on the system. If assigned the special value
303 <literal>infinity</literal>, no memory limit is applied. This controls the
304 <literal>memory.limit_in_bytes</literal> control group attribute. For details about this control group
305 attribute, see <ulink
306 url="https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt">memory.txt</ulink>.</para>
307
308 <para>Implies <literal>MemoryAccounting=true</literal>.</para>
309
310 <para>This setting is supported only if the legacy control group hierarchy is used. Use
311 <varname>MemoryMax=</varname> on systems using the unified control group hierarchy.</para>
312 </listitem>
313 </varlistentry>
314
315 <varlistentry>
316 <term><varname>TasksAccounting=</varname></term>
317
318 <listitem>
319 <para>Turn on task accounting for this unit. Takes a
320 boolean argument. If enabled, the system manager will keep
321 track of the number of tasks in the unit. The number of
322 tasks accounted this way includes both kernel threads and
323 userspace processes, with each thread counting
324 individually. Note that turning on tasks accounting for one
325 unit will also implicitly turn it on for all units contained
326 in the same slice and for all its parent slices and the
327 units contained therein. The system default for this setting
328 may be controlled with
329 <varname>DefaultTasksAccounting=</varname> in
330 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
331 </listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><varname>TasksMax=<replaceable>N</replaceable></varname></term>
336
337 <listitem>
338 <para>Specify the maximum number of tasks that may be created in the unit. This ensures that the number of
339 tasks accounted for the unit (see above) stays below a specific limit. This either takes an absolute number
340 of tasks or a percentage value that is taken relative to the configured maximum number of tasks on the
341 system. If assigned the special value <literal>infinity</literal>, no tasks limit is applied. This controls
342 the <literal>pids.max</literal> control group attribute. For details about this control group attribute, see
343 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v1/pids.txt">pids.txt</ulink>.</para>
344
345 <para>Implies <literal>TasksAccounting=true</literal>. The
346 system default for this setting may be controlled with
347 <varname>DefaultTasksMax=</varname> in
348 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
349 </listitem>
350 </varlistentry>
351
352 <varlistentry>
353 <term><varname>IOAccounting=</varname></term>
354
355 <listitem>
356 <para>Turn on Block I/O accounting for this unit, if the unified control group hierarchy is used on the
357 system. Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
358 turn it on for all units contained in the same slice and all for its parent slices and the units contained
359 therein. The system default for this setting may be controlled with <varname>DefaultIOAccounting=</varname>
360 in
361 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
362
363 <para>This setting is supported only if the unified control group hierarchy is used. Use
364 <varname>BlockIOAccounting=</varname> on systems using the legacy control group hierarchy.</para>
365 </listitem>
366 </varlistentry>
367
368 <varlistentry>
369 <term><varname>IOWeight=<replaceable>weight</replaceable></varname></term>
370 <term><varname>StartupIOWeight=<replaceable>weight</replaceable></varname></term>
371
372 <listitem>
373 <para>Set the default overall block I/O weight for the executed processes, if the unified control group
374 hierarchy is used on the system. Takes a single weight value (between 1 and 10000) to set the default block
375 I/O weight. This controls the <literal>io.weight</literal> control group attribute, which defaults to
376 100. For details about this control group attribute, see <ulink
377 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>. The available I/O
378 bandwidth is split up among all units within one slice relative to their block I/O weight.</para>
379
380 <para>While <varname>StartupIOWeight=</varname> only applies
381 to the startup phase of the system,
382 <varname>IOWeight=</varname> applies to the later runtime of
383 the system, and if the former is not set also to the startup
384 phase. This allows prioritizing specific services at boot-up
385 differently than during runtime.</para>
386
387 <para>Implies <literal>IOAccounting=true</literal>.</para>
388
389 <para>This setting is supported only if the unified control group hierarchy is used. Use
390 <varname>BlockIOWeight=</varname> and <varname>StartupBlockIOWeight=</varname> on systems using the legacy
391 control group hierarchy.</para>
392 </listitem>
393 </varlistentry>
394
395 <varlistentry>
396 <term><varname>IODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
397
398 <listitem>
399 <para>Set the per-device overall block I/O weight for the executed processes, if the unified control group
400 hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to specify
401 the device specific weight value, between 1 and 10000. (Example: "/dev/sda 1000"). The file path may be
402 specified as path to a block device node or as any other file, in which case the backing block device of the
403 file system of the file is determined. This controls the <literal>io.weight</literal> control group
404 attribute, which defaults to 100. Use this option multiple times to set weights for multiple devices. For
405 details about this control group attribute, see <ulink
406 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.</para>
407
408 <para>Implies <literal>IOAccounting=true</literal>.</para>
409
410 <para>This setting is supported only if the unified control group hierarchy is used. Use
411 <varname>BlockIODeviceWeight=</varname> on systems using the legacy control group hierarchy.</para>
412 </listitem>
413 </varlistentry>
414
415 <varlistentry>
416 <term><varname>IOReadBandwidthMax=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
417 <term><varname>IOWriteBandwidthMax=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
418
419 <listitem>
420 <para>Set the per-device overall block I/O bandwidth maximum limit for the executed processes, if the unified
421 control group hierarchy is used on the system. This limit is not work-conserving and the executed processes
422 are not allowed to use more even if the device has idle capacity. Takes a space-separated pair of a file
423 path and a bandwidth value (in bytes per second) to specify the device specific bandwidth. The file path may
424 be a path to a block device node, or as any other file in which case the backing block device of the file
425 system of the file is used. If the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is
426 parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes, respectively, to the base of 1000. (Example:
427 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the <literal>io.max</literal> control
428 group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For details
429 about this control group attribute, see <ulink
430 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.
431 </para>
432
433 <para>Implies <literal>IOAccounting=true</literal>.</para>
434
435 <para>This setting is supported only if the unified control group hierarchy is used. Use
436 <varname>BlockIOAccounting=</varname> on systems using the legacy control group hierarchy.</para>
437 </listitem>
438 </varlistentry>
439
440 <varlistentry>
441 <term><varname>IOReadIOPSMax=<replaceable>device</replaceable> <replaceable>IOPS</replaceable></varname></term>
442 <term><varname>IOWriteIOPSMax=<replaceable>device</replaceable> <replaceable>IOPS</replaceable></varname></term>
443
444 <listitem>
445 <para>Set the per-device overall block I/O IOs-Per-Second maximum limit for the executed processes, if the
446 unified control group hierarchy is used on the system. This limit is not work-conserving and the executed
447 processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair of
448 a file path and an IOPS value to specify the device specific IOPS. The file path may be a path to a block
449 device node, or as any other file in which case the backing block device of the file system of the file is
450 used. If the IOPS is suffixed with K, M, G, or T, the specified IOPS is parsed as KiloIOPS, MegaIOPS,
451 GigaIOPS, or TeraIOPS, respectively, to the base of 1000. (Example:
452 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 1K"). This controls the <literal>io.max</literal> control
453 group attributes. Use this option multiple times to set IOPS limits for multiple devices. For details about
454 this control group attribute, see <ulink
455 url="https://www.kernel.org/doc/Documentation/cgroup-v2.txt">cgroup-v2.txt</ulink>.
456 </para>
457
458 <para>Implies <literal>IOAccounting=true</literal>.</para>
459
460 <para>This setting is supported only if the unified control group hierarchy is used.</para>
461 </listitem>
462 </varlistentry>
463
464 <varlistentry>
465 <term><varname>BlockIOAccounting=</varname></term>
466
467 <listitem>
468 <para>Turn on Block I/O accounting for this unit, if the legacy control group hierarchy is used on the
469 system. Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
470 turn it on for all units contained in the same slice and all for its parent slices and the units contained
471 therein. The system default for this setting may be controlled with
472 <varname>DefaultBlockIOAccounting=</varname> in
473 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
474
475 <para>This setting is supported only if the legacy control group hierarchy is used. Use
476 <varname>IOAccounting=</varname> on systems using the unified control group hierarchy.</para>
477 </listitem>
478 </varlistentry>
479
480 <varlistentry>
481 <term><varname>BlockIOWeight=<replaceable>weight</replaceable></varname></term>
482 <term><varname>StartupBlockIOWeight=<replaceable>weight</replaceable></varname></term>
483
484 <listitem><para>Set the default overall block I/O weight for the executed processes, if the legacy control
485 group hierarchy is used on the system. Takes a single weight value (between 10 and 1000) to set the default
486 block I/O weight. This controls the <literal>blkio.weight</literal> control group attribute, which defaults to
487 500. For details about this control group attribute, see <ulink
488 url="https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt">blkio-controller.txt</ulink>.
489 The available I/O bandwidth is split up among all units within one slice relative to their block I/O
490 weight.</para>
491
492 <para>While <varname>StartupBlockIOWeight=</varname> only
493 applies to the startup phase of the system,
494 <varname>BlockIOWeight=</varname> applies to the later runtime
495 of the system, and if the former is not set also to the
496 startup phase. This allows prioritizing specific services at
497 boot-up differently than during runtime.</para>
498
499 <para>Implies
500 <literal>BlockIOAccounting=true</literal>.</para>
501
502 <para>This setting is supported only if the legacy control group hierarchy is used. Use
503 <varname>IOWeight=</varname> and <varname>StartupIOWeight=</varname> on systems using the unified control group
504 hierarchy.</para>
505
506 </listitem>
507 </varlistentry>
508
509 <varlistentry>
510 <term><varname>BlockIODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
511
512 <listitem>
513 <para>Set the per-device overall block I/O weight for the executed processes, if the legacy control group
514 hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to specify
515 the device specific weight value, between 10 and 1000. (Example: "/dev/sda 500"). The file path may be
516 specified as path to a block device node or as any other file, in which case the backing block device of the
517 file system of the file is determined. This controls the <literal>blkio.weight_device</literal> control group
518 attribute, which defaults to 1000. Use this option multiple times to set weights for multiple devices. For
519 details about this control group attribute, see <ulink
520 url="https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt">blkio-controller.txt</ulink>.</para>
521
522 <para>Implies
523 <literal>BlockIOAccounting=true</literal>.</para>
524
525 <para>This setting is supported only if the legacy control group hierarchy is used. Use
526 <varname>IODeviceWeight=</varname> on systems using the unified control group hierarchy.</para>
527 </listitem>
528 </varlistentry>
529
530 <varlistentry>
531 <term><varname>BlockIOReadBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
532 <term><varname>BlockIOWriteBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
533
534 <listitem>
535 <para>Set the per-device overall block I/O bandwidth limit for the executed processes, if the legacy control
536 group hierarchy is used on the system. Takes a space-separated pair of a file path and a bandwidth value (in
537 bytes per second) to specify the device specific bandwidth. The file path may be a path to a block device
538 node, or as any other file in which case the backing block device of the file system of the file is used. If
539 the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is parsed as Kilobytes, Megabytes,
540 Gigabytes, or Terabytes, respectively, to the base of 1000. (Example:
541 "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the
542 <literal>blkio.throttle.read_bps_device</literal> and <literal>blkio.throttle.write_bps_device</literal>
543 control group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For
544 details about these control group attributes, see <ulink
545 url="https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt">blkio-controller.txt</ulink>.
546 </para>
547
548 <para>Implies
549 <literal>BlockIOAccounting=true</literal>.</para>
550
551 <para>This setting is supported only if the legacy control group hierarchy is used. Use
552 <varname>IOReadBandwidthMax=</varname> and <varname>IOWriteBandwidthMax=</varname> on systems using the
553 unified control group hierarchy.</para>
554 </listitem>
555 </varlistentry>
556
557 <varlistentry>
558 <term><varname>DeviceAllow=</varname></term>
559
560 <listitem>
561 <para>Control access to specific device nodes by the
562 executed processes. Takes two space-separated strings: a
563 device node specifier followed by a combination of
564 <constant>r</constant>, <constant>w</constant>,
565 <constant>m</constant> to control
566 <emphasis>r</emphasis>eading, <emphasis>w</emphasis>riting,
567 or creation of the specific device node(s) by the unit
568 (<emphasis>m</emphasis>knod), respectively. This controls
569 the <literal>devices.allow</literal> and
570 <literal>devices.deny</literal> control group
571 attributes. For details about these control group
572 attributes, see <ulink
573 url="https://www.kernel.org/doc/Documentation/cgroup-v1/devices.txt">devices.txt</ulink>.</para>
574
575 <para>The device node specifier is either a path to a device
576 node in the file system, starting with
577 <filename>/dev/</filename>, or a string starting with either
578 <literal>char-</literal> or <literal>block-</literal>
579 followed by a device group name, as listed in
580 <filename>/proc/devices</filename>. The latter is useful to
581 whitelist all current and future devices belonging to a
582 specific device group at once. The device group is matched
583 according to file name globbing rules, you may hence use the
584 <literal>*</literal> and <literal>?</literal>
585 wildcards. Examples: <filename>/dev/sda5</filename> is a
586 path to a device node, referring to an ATA or SCSI block
587 device. <literal>char-pts</literal> and
588 <literal>char-alsa</literal> are specifiers for all pseudo
589 TTYs and all ALSA sound devices,
590 respectively. <literal>char-cpu/*</literal> is a specifier
591 matching all CPU related device groups.</para>
592 </listitem>
593 </varlistentry>
594
595 <varlistentry>
596 <term><varname>DevicePolicy=auto|closed|strict</varname></term>
597
598 <listitem>
599 <para>
600 Control the policy for allowing device access:
601 </para>
602 <variablelist>
603 <varlistentry>
604 <term><option>strict</option></term>
605 <listitem>
606 <para>means to only allow types of access that are
607 explicitly specified.</para>
608 </listitem>
609 </varlistentry>
610
611 <varlistentry>
612 <term><option>closed</option></term>
613 <listitem>
614 <para>in addition, allows access to standard pseudo
615 devices including
616 <filename>/dev/null</filename>,
617 <filename>/dev/zero</filename>,
618 <filename>/dev/full</filename>,
619 <filename>/dev/random</filename>, and
620 <filename>/dev/urandom</filename>.
621 </para>
622 </listitem>
623 </varlistentry>
624
625 <varlistentry>
626 <term><option>auto</option></term>
627 <listitem>
628 <para>
629 in addition, allows access to all devices if no
630 explicit <varname>DeviceAllow=</varname> is present.
631 This is the default.
632 </para>
633 </listitem>
634 </varlistentry>
635 </variablelist>
636 </listitem>
637 </varlistentry>
638
639 <varlistentry>
640 <term><varname>Slice=</varname></term>
641
642 <listitem>
643 <para>The name of the slice unit to place the unit
644 in. Defaults to <filename>system.slice</filename> for all
645 non-instantiated units of all unit types (except for slice
646 units themselves see below). Instance units are by default
647 placed in a subslice of <filename>system.slice</filename>
648 that is named after the template name.</para>
649
650 <para>This option may be used to arrange systemd units in a
651 hierarchy of slices each of which might have resource
652 settings applied.</para>
653
654 <para>For units of type slice, the only accepted value for
655 this setting is the parent slice. Since the name of a slice
656 unit implies the parent slice, it is hence redundant to ever
657 set this parameter directly for slice units.</para>
658
659 <para>Special care should be taken when relying on the default slice assignment in templated service units
660 that have <varname>DefaultDependencies=no</varname> set, see
661 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, section
662 "Automatic Dependencies" for details.</para>
663
664 </listitem>
665 </varlistentry>
666
667 <varlistentry>
668 <term><varname>Delegate=</varname></term>
669
670 <listitem>
671 <para>Turns on delegation of further resource control
672 partitioning to processes of the unit. For unprivileged
673 services (i.e. those using the <varname>User=</varname>
674 setting), this allows processes to create a subhierarchy
675 beneath its control group path. For privileged services and
676 scopes, this ensures the processes will have all control
677 group controllers enabled.</para>
678 </listitem>
679 </varlistentry>
680
681 </variablelist>
682 </refsect1>
683
684 <refsect1>
685 <title>See Also</title>
686 <para>
687 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
688 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
689 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
690 <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
691 <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
692 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
693 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
694 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
695 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
696 <citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
697 The documentation for control groups and specific controllers in the Linux kernel:
698 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v1/cgroups.txt">cgroups.txt</ulink>,
699 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v1/cpuacct.txt">cpuacct.txt</ulink>,
700 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt">memory.txt</ulink>,
701 <ulink url="https://www.kernel.org/doc/Documentation/cgroup-v1/blkio-controller.txt">blkio-controller.txt</ulink>.
702 </para>
703 </refsect1>
704 </refentry>