| 1 |
<?xml version='1.0'?> |
| 2 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refentry id="systemd.slice" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
<refentryinfo> |
| 8 |
<title>systemd.slice</title> |
| 9 |
<productname>systemd</productname> |
| 10 |
</refentryinfo> |
| 11 |
|
| 12 |
<refmeta> |
| 13 |
<refentrytitle>systemd.slice</refentrytitle> |
| 14 |
<manvolnum>5</manvolnum> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>systemd.slice</refname> |
| 19 |
<refpurpose>Slice unit configuration</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<para><filename><replaceable>slice</replaceable>.slice</filename></para> |
| 24 |
</refsynopsisdiv> |
| 25 |
|
| 26 |
<refsect1> |
| 27 |
<title>Description</title> |
| 28 |
|
| 29 |
<para>A unit configuration file whose name ends in <literal>.slice</literal> encodes information about a slice |
| 30 |
unit. A slice unit is a concept for hierarchically managing resources of a group of processes. This management is |
| 31 |
performed by creating a node in the Linux Control Group (cgroup) tree. Units that manage processes (primarily scope |
| 32 |
and service units) may be assigned to a specific slice. For each slice, certain resource limits may be set that |
| 33 |
apply to all processes of all units contained in that slice. Slices are organized hierarchically in a tree. The |
| 34 |
name of the slice encodes the location in the tree. The name consists of a dash-separated series of names, which |
| 35 |
describes the path to the slice from the root slice. The root slice is named <filename>-.slice</filename>. Example: |
| 36 |
<filename>foo-bar.slice</filename> is a slice that is located within <filename>foo.slice</filename>, which in turn |
| 37 |
is located in the root slice <filename>-.slice</filename>. |
| 38 |
</para> |
| 39 |
|
| 40 |
<para>Note that slice units cannot be templated, nor is possible to add multiple names to a slice unit by creating |
| 41 |
additional symlinks to its unit file.</para> |
| 42 |
|
| 43 |
<para>By default, service and scope units are placed in |
| 44 |
<filename>system.slice</filename>, virtual machines and containers |
| 45 |
registered with |
| 46 |
<citerefentry><refentrytitle>systemd-machined</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 47 |
are found in <filename>machine.slice</filename>, and user sessions |
| 48 |
handled by |
| 49 |
<citerefentry><refentrytitle>systemd-logind</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 50 |
in <filename>user.slice</filename>. See |
| 51 |
<citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 52 |
for more information.</para> |
| 53 |
|
| 54 |
<para>See |
| 55 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
| 56 |
for the common options of all unit configuration |
| 57 |
files. The common configuration items are configured |
| 58 |
in the generic [Unit] and [Install] sections. The |
| 59 |
slice specific configuration options are configured in |
| 60 |
the [Slice] section. Currently, only generic resource control settings |
| 61 |
as described in |
| 62 |
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> are allowed. |
| 63 |
</para> |
| 64 |
|
| 65 |
<para>See the <ulink |
| 66 |
url="https://systemd.io/CONTROL_GROUP_INTERFACE">New |
| 67 |
Control Group Interfaces</ulink> for an introduction on how to make |
| 68 |
use of slice units from programs.</para> |
| 69 |
</refsect1> |
| 70 |
|
| 71 |
<refsect1> |
| 72 |
<title>Automatic Dependencies</title> |
| 73 |
|
| 74 |
<refsect2> |
| 75 |
<title>Implicit Dependencies</title> |
| 76 |
|
| 77 |
<para>The following dependencies are implicitly added:</para> |
| 78 |
|
| 79 |
<itemizedlist> |
| 80 |
<listitem><para>Slice units automatically gain dependencies of type |
| 81 |
<varname>After=</varname> and <varname>Requires=</varname> on |
| 82 |
their immediate parent slice unit.</para></listitem> |
| 83 |
</itemizedlist> |
| 84 |
</refsect2> |
| 85 |
|
| 86 |
<refsect2> |
| 87 |
<title>Default Dependencies</title> |
| 88 |
|
| 89 |
<para>The following dependencies are added unless <varname>DefaultDependencies=no</varname> is set:</para> |
| 90 |
|
| 91 |
<itemizedlist> |
| 92 |
<listitem><para>Slice units will automatically have dependencies of type <varname>Conflicts=</varname> and |
| 93 |
<varname>Before=</varname> on |
| 94 |
<filename>shutdown.target</filename>. These ensure that slice units are removed prior to system shutdown. |
| 95 |
Only slice units involved with late system shutdown should disable |
| 96 |
<varname>DefaultDependencies=</varname> option.</para></listitem> |
| 97 |
</itemizedlist> |
| 98 |
</refsect2> |
| 99 |
</refsect1> |
| 100 |
|
| 101 |
<refsect1> |
| 102 |
<title>Options</title> |
| 103 |
|
| 104 |
<para>Slice unit files may include [Unit] and [Install] sections, which are described in |
| 105 |
<citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
| 106 |
|
| 107 |
<para>Slice files may include a [Slice] section. Many options that may be used in this section are shared |
| 108 |
with other unit types. These options are documented in |
| 109 |
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> |
| 110 |
|
| 111 |
<para>The options specific to the [Slice] section of slice units are the following:</para> |
| 112 |
|
| 113 |
<variablelist class='unit-directives'> |
| 114 |
<varlistentry> |
| 115 |
<term><varname>ConcurrencyHardMax=</varname></term> |
| 116 |
<term><varname>ConcurrencySoftMax=</varname></term> |
| 117 |
|
| 118 |
<listitem><para>Configures a hard and a soft limit on the maximum number of units assigned to this |
| 119 |
slice (or any descendent slices) that may be active at the same time. If the hard limit is reached no |
| 120 |
further units associated with the slice may be activated, and their activation will fail with an |
| 121 |
error. If the soft limit is reached any further requested activation of units will be queued, but no |
| 122 |
immediate error is generated. The queued activation job will remain queued until the number of |
| 123 |
concurrent active units within the slice is below the limit again.</para> |
| 124 |
|
| 125 |
<para>If the special value <literal>infinity</literal> is specified, no concurrency limit is |
| 126 |
enforced. This is the default.</para> |
| 127 |
|
| 128 |
<para>Note that if multiple start jobs are queued for units, and all their dependencies are fulfilled |
| 129 |
they'll be processed in an order that is dependent on the unit type, the CPU weight (for unit types |
| 130 |
that know the concept, such as services), the nice level (similar), and finally in alphabetical order |
| 131 |
by the unit name. This may be used to influence dispatching order when using |
| 132 |
<varname>ConcurrencySoftMax=</varname> to pace concurrency within a slice unit.</para> |
| 133 |
|
| 134 |
<para>Note that these options have a hierarchial effect: a limit set for a slice unit will apply to |
| 135 |
both the units immediately within the slice, but also all units further down the slice tree. Also |
| 136 |
note that each sub-slice unit counts as one unit each too, and thus when choosing a limit for a slice |
| 137 |
hierarchy the limit must provide room for both the payload units (i.e. services, mounts, …) and |
| 138 |
structural units (i.e. slice units), if any are defined.</para> |
| 139 |
|
| 140 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 141 |
</varlistentry> |
| 142 |
</variablelist> |
| 143 |
|
| 144 |
</refsect1> |
| 145 |
|
| 146 |
<refsect1> |
| 147 |
<title>See Also</title> |
| 148 |
<para><simplelist type="inline"> |
| 149 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 150 |
<member><citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 151 |
<member><citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 152 |
<member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 153 |
<member><citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 154 |
<member><citerefentry><refentrytitle>systemd.special</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 155 |
<member><citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 156 |
</simplelist></para> |
| 157 |
</refsect1> |
| 158 |
|
| 159 |
</refentry> |