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