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