systemd.resource-control.xml revision 0af20ea2ee2af2bcf2258e7a8e1a13181a6a75d6
3802a3d3d7af51ddff31943d5514382f01265770Lennart Poettering<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek This file is part of systemd.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek Copyright 2013 Zbigniew Jędrzejewski-Szmek
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek (at your option) any later version.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett <refentryinfo>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <title>systemd.resource-control</title>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <productname>systemd</productname>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <email>lennart@poettering.net</email>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <refentrytitle>systemd.resource-control</refentrytitle>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <refname>systemd.resource-control</refname>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <refpurpose>Resource control unit settings</refpurpose>
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett </refnamediv>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <refsynopsisdiv>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <filename><replaceable>slice</replaceable>.slice</filename>,
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen <filename><replaceable>scope</replaceable>.scope</filename>,
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen <filename><replaceable>service</replaceable>.service</filename>,
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett <filename><replaceable>socket</replaceable>.socket</filename>,
12b42c76672a66c2d4ea7212c14f8f1b5a62b78dTom Gundersen <filename><replaceable>mount</replaceable>.mount</filename>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <filename><replaceable>swap</replaceable>.swap</filename>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek </refsynopsisdiv>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>Unit configuration files for services, slices, scopes,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek sockets, mount points, and swap devices share a subset of
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek configuration options for resource control of spawned
e93549ef29c4123d9ee45acb5815048390201e49Zbigniew Jędrzejewski-Szmek processes. Internally, this relies on the Control Groups
301af7e4853ad0281402f8d86f5a77c6cb7ce9f4Josh Triplett kernel concept for organizing processes in a hierarchical tree of
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek named groups for the purpose of resource management.</para>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>This man page lists the configuration options shared by
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek those six unit types. See
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek for the common options of all unit configuration files, and
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek for more information on the specific unit configuration files. The
8d0e0ddda6501479eb69164687c83c1a7667b33aJan Engelhardt resource control configuration options are configured in the
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek [Slice], [Scope], [Service], [Socket], [Mount], or [Swap]
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek sections, depending on the unit type.</para>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek url="http://www.freedesktop.org/wiki/Software/systemd/ControlGroupInterface/">New
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek Control Group Interfaces</ulink> for an introduction on how to make
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek use of resource control APIs from programs.</para>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <title>Automatic Dependencies</title>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>Units with the <varname>Slice=</varname> setting set get
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek automatic <varname>Requires=</varname> and
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <varname>After=</varname> dependencies on the specified slice
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>Units of the types listed above can have settings
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek for resource control configuration:</para>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <variablelist class='unit-directives'>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <term><varname>CPUAccounting=</varname></term>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>Turn on CPU usage accounting for this unit. Takes a
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek boolean argument. Note that turning on CPU accounting for
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek one unit will also implicitly turn it on for all units
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek contained in the same slice and for all its parent slices
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek and the units contained therein. The system default for this
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek setting may be controlled with
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <varname>DefaultCPUAccounting=</varname> in
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering </varlistentry>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering <varlistentry>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering <term><varname>CPUShares=<replaceable>weight</replaceable></varname></term>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering <term><varname>StartupCPUShares=<replaceable>weight</replaceable></varname></term>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering <para>Assign the specified CPU time share weight to the
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering processes executed. These options take an integer value and
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering control the <literal>cpu.shares</literal> control group
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering attribute. The allowed range is 2 to 262144. Defaults to
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering 1024. For details about this control group attribute, see
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering url="https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">sched-design-CFS.txt</ulink>.
cbfaff65cb086e3eb3709cf86dcf63b46622389bKarel Zak The available CPU time is split up among all units within
5470c03b37d8421a903564c2c8028c8b8d67d403Lennart Poettering one slice relative to their CPU time share weight.</para>
5470c03b37d8421a903564c2c8028c8b8d67d403Lennart Poettering <para>While <varname>StartupCPUShares=</varname> only
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering applies to the startup phase of the system,
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <varname>CPUShares=</varname> applies to normal runtime of
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek the system, and if the former is not set also to the startup
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek phase. Using <varname>StartupCPUShares=</varname> allows
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek prioritizing specific services at boot-up differently than
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek during normal runtime.</para>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <para>These options imply
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <literal>CPUAccounting=true</literal>.</para>
0dc5d23c85db85f96b141d4d32deee8018e56a6aLennart Poettering </varlistentry>
3cc765d2718ac9b4ff978044ceabf5ad59d73edfZbigniew Jędrzejewski-Szmek <term><varname>CPUQuota=</varname></term>
url="https://www.kernel.org/doc/Documentation/scheduler/sched-design-CFS.txt">sched-design-CFS.txt</ulink>.</para>
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
url="https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.
<term><varname>BlockIODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
url="https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.</para>
<term><varname>BlockIOReadBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
<term><varname>BlockIOWriteBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
url="https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.
<ulink url="https://www.kernel.org/doc/Documentation/cgroups/net_cls.txt">net_cls controller</ulink>
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
<ulink url="https://www.kernel.org/doc/Documentation/cgroups/blkio-controller.txt">blkio-controller.txt</ulink>.