chiark / gitweb /
e31faf522e698c343c295f76bc962dc32969941a
[elogind.git] / man / systemd.cgroup.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5
6 <!--
7 This file is part of systemd.
8
9 Copyright 2013 Zbigniew JÄ™drzejewski-Szmek
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 -->
24
25 <refentry id="systemd.cgroup">
26   <refentryinfo>
27     <title>systemd.cgroup</title>
28     <productname>systemd</productname>
29
30     <authorgroup>
31       <author>
32         <contrib>Developer</contrib>
33         <firstname>Lennart</firstname>
34         <surname>Poettering</surname>
35         <email>lennart@poettering.net</email>
36       </author>
37     </authorgroup>
38   </refentryinfo>
39
40   <refmeta>
41     <refentrytitle>systemd.cgroup</refentrytitle>
42     <manvolnum>5</manvolnum>
43   </refmeta>
44
45   <refnamediv>
46     <refname>systemd.cgroup</refname>
47     <refpurpose>Cgroup configuration unit settings</refpurpose>
48   </refnamediv>
49
50   <refsynopsisdiv>
51     <para>
52       <filename><replaceable>slice</replaceable>.slice</filename>,
53       <filename><replaceable>scope</replaceable>.scope</filename>,
54       <filename><replaceable>service</replaceable>.service</filename>,
55       <filename><replaceable>socket</replaceable>.socket</filename>,
56       <filename><replaceable>mount</replaceable>.mount</filename>,
57       <filename><replaceable>swap</replaceable>.swap</filename>
58     </para>
59   </refsynopsisdiv>
60
61   <refsect1>
62     <title>Description</title>
63
64     <para>Unit configuration files for services, slices, scopes,
65     sockets, mount points, and swap devices share a subset of
66     configuration options which configure the control group settings
67     for spawned processes.</para>
68
69     <para>This man page lists the configuration options shared by
70     those six unit types. See
71     <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
72     for the common options of all unit configuration files, and
73     <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
74     <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
75     <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
76     <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
77     <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
78     and
79     <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
80     for more information on the specific unit configuration files. The
81     execution-specific configuration options are configured in the
82     [Slice], [Scope], [Service], [Socket], [Mount], or [Swap]
83     sections, depending on the unit type.</para>
84   </refsect1>
85
86   <refsect1>
87     <title>Options</title>
88
89     <para>Units of the types listed above can have settings
90     for cgroup configuration:</para>
91
92     <variablelist class='unit-directives'>
93       <varlistentry>
94         <term><varname>CPUAccounting=</varname></term>
95
96         <listitem>
97           <para>Turn on CPU usage accounting for this
98           unit.</para>
99         </listitem>
100       </varlistentry>
101
102       <varlistentry>
103         <term><varname>BlockIOAccounting=</varname></term>
104
105         <listitem>
106           <para>Turn on Block IO bandwidth accounting
107           for this unit.</para>
108         </listitem>
109       </varlistentry>
110
111       <varlistentry>
112         <term><varname>MemoryAccounting=</varname></term>
113
114         <listitem>
115           <para>Turn on process and kernel memory
116           accounting for this unit.</para>
117         </listitem>
118       </varlistentry>
119
120
121       <varlistentry>
122         <term><varname>CPUShares=<replaceable>weight</replaceable></varname></term>
123
124         <listitem>
125           <para>Assign the specified overall CPU time share weight to
126           the processes executed. Takes an integer value. This
127           controls the <literal>cpu.shares</literal> control group
128           attribute, which defaults to 1024. For details about this
129           control group attribute, see <ulink
130           url="http://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">sched-design-CFS.txt</ulink>.</para>
131
132           <para>Implies <literal>CPUAccounting=true</literal>.</para>
133         </listitem>
134       </varlistentry>
135
136       <varlistentry>
137         <term><varname>MemoryLimit=<replaceable>bytes</replaceable></varname></term>
138         <term><varname>MemorySoftLimit=<replaceable>bytes</replaceable></varname></term>
139
140         <listitem>
141           <para>Specify the hard and soft limits on maximum memory
142           usage of the executed processes. The "hard" limit specifies
143           how much process and kernel memory can be used by tasks in
144           this unit, when there is no memory contention. If the kernel
145           detects memory contention, memory reclaim will be performed
146           until the memory usage is within the "soft" limit. Takes a
147           memory size in bytes. If the value is suffixed with K, M, G
148           or T, the specified memory size is parsed as Kilobytes,
149           Megabytes, Gigabytes, or Terabytes (with the base 1024),
150           respectively. This controls the
151           <literal>memory.limit_in_bytes</literal> and
152           <literal>memory.soft_limit_in_bytes</literal> control group
153           attributes. For details about these control group attributes,
154           see <ulink
155           url="http://www.kernel.org/doc/Documentation/cgroups/memory.txt">memory.txt</ulink>.</para>
156
157           <para>Implies <literal>MemoryAccounting=true</literal>.</para>
158         </listitem>
159       </varlistentry>
160
161       <varlistentry>
162         <term><varname>BlockIOWeight=<replaceable>weight</replaceable></varname></term>
163
164         <listitem><para>Set the default
165         overall block IO weight for the
166         executed processes. Takes a single
167         weight value (between 10 and 1000) to
168         set the default block IO weight. This
169         controls the
170         <literal>blkio.weight</literal>
171         control group attribute, which
172         defaults to 1000. For details about
173         this control group attribute, see
174         <ulink
175             url="http://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.</para></listitem>
176       </varlistentry>
177
178       <varlistentry>
179         <term><varname>BlockIODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
180
181         <listitem>
182           <para>Set the per-device overall block IO weight for the
183           executed processes. Takes a space-separated pair of a file
184           path and a weight value to specify the device specific
185           weight value, between 10 and 1000. (Example: "/dev/sda
186           500"). The file path may be specified as path to a block
187           device node or as any other file in which case the backing
188           block device of the file system of the file is
189           determined. This controls the
190           <literal>blkio.weight_device</literal> control group
191           attribute, which defaults to 1000. Use this option multiple
192           times to set weights for multiple devices. For details about
193           this control group attribute, see <ulink
194           url="http://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.</para>
195         </listitem>
196       </varlistentry>
197
198       <varlistentry>
199         <term><varname>BlockIOReadBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
200         <term><varname>BlockIOWriteBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
201
202         <listitem>
203           <para>Set the per-device overall block IO bandwidth limit
204           for the executed processes. Takes a space-separated pair of
205           a file path and a bandwidth value (in bytes per second) to
206           specify the device specific bandwidth. The file path may be
207           a path to a block device node, or as any other file in which
208           case the backing block device of the file system of the file
209           is used. If the bandwidth is suffixed with K, M, G, or T,
210           the specified bandwidth is parsed as Kilobytes, Megabytes,
211           Gigabytes, or Terabytes, respectively (Example:
212           "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This
213           controls the <literal>blkio.read_bps_device</literal> and
214           <literal>blkio.write_bps_device</literal> control group
215           attributes. Use this option multiple times to set bandwidth
216           limits for multiple devices. For details about these control
217           group attributes, see
218           <ulink url="http://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.
219           </para>
220         </listitem>
221       </varlistentry>
222
223       <varlistentry>
224         <term><varname>DeviceAllow=</varname></term>
225
226         <listitem>
227           <para>Control access to specific device nodes by the
228           executed processes. Takes two space-separated strings: a
229           device node path (such as <filename>/dev/null</filename>)
230           followed by a combination of <constant>r</constant>,
231           <constant>w</constant>, <constant>m</constant> to control
232           <emphasis>r</emphasis>eading, <emphasis>w</emphasis>riting,
233           or creation of the specific device node by the unit
234           (<emphasis>m</emphasis>knod), respectively. This controls
235           the <literal>devices.allow</literal> and
236           <literal>devices.deny</literal> control group
237           attributes. For details about these control group attributes,
238           see <ulink
239           url="http://www.kernel.org/doc/Documentation/cgroups/devices.txt">devices.txt</ulink>.</para>
240         </listitem>
241       </varlistentry>
242
243       <varlistentry>
244         <term><varname>DevicePolicy=auto|closed|strict</varname></term>
245
246         <listitem>
247           <para>
248             Control the policy for allowing device access:
249           </para>
250           <variablelist>
251             <varlistentry>
252               <term><option>strict</option></term>
253               <listitem>
254                 <para>means to only allow types of access that are
255                 explicitly specified.</para>
256               </listitem>
257             </varlistentry>
258
259             <varlistentry>
260               <term><option>closed</option></term>
261               <listitem>
262                 <para>in addition, allows access to standard pseudo
263                 devices including
264                 <filename>/dev/null</filename>,
265                 <filename>/dev/zero</filename>,
266                 <filename>/dev/full</filename>,
267                 <filename>/dev/random</filename>, and
268                 <filename>/dev/urandom</filename>.
269                 </para>
270               </listitem>
271             </varlistentry>
272
273             <varlistentry>
274               <term><option>auto</option></term>
275               <listitem>
276                 <para>
277                   in addition, allows access to all devices if no
278                   explicit <varname>DeviceAllow=</varname> is present.
279                   This is the default.
280                 </para>
281               </listitem>
282             </varlistentry>
283           </variablelist>
284         </listitem>
285       </varlistentry>
286     </variablelist>
287   </refsect1>
288
289   <refsect1>
290     <title>See Also</title>
291     <para>
292       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
293       <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
294       <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
295       <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
296       <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
297       <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
298       <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
299       <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
300       <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
301       The documentation for control groups and specific controllers in the Linux kernel:
302       <ulink url="http://www.kernel.org/doc/Documentation/cgroups/cgroups.txt">cgroups.txt</ulink>,
303       <ulink url="http://www.kernel.org/doc/Documentation/cgroups/cpuacct.txt">cpuacct.txt</ulink>,
304       <ulink url="http://www.kernel.org/doc/Documentation/cgroups/memory.txt">memory.txt</ulink>,
305       <ulink url="http://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.
306     </para>
307   </refsect1>
308 </refentry>