Merge pull request #24072 from poettering/remove-cgroupsv1-docs

decgroupsv1ification: first steps – remove from docs, and generate warnings
This commit is contained in:
Lennart Poettering 2022-08-24 17:00:53 +02:00 committed by GitHub
commit 771fe73c75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 147 additions and 339 deletions

View file

@ -71,8 +71,6 @@
<term><varname>systemd.default_standard_error=</varname></term> <term><varname>systemd.default_standard_error=</varname></term>
<term><varname>systemd.setenv=</varname></term> <term><varname>systemd.setenv=</varname></term>
<term><varname>systemd.machine_id=</varname></term> <term><varname>systemd.machine_id=</varname></term>
<term><varname>systemd.unified_cgroup_hierarchy</varname></term>
<term><varname>systemd.legacy_systemd_cgroup_controller</varname></term>
<term><varname>systemd.set_credential=</varname></term> <term><varname>systemd.set_credential=</varname></term>
<term><varname>systemd.import_credentials=</varname></term> <term><varname>systemd.import_credentials=</varname></term>
<listitem> <listitem>
@ -559,7 +557,19 @@
the hostname, it simply controls the initial hostname set during early boot.</para></listitem> the hostname, it simply controls the initial hostname set during early boot.</para></listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</refsect1>
<refsect1>
<title>History</title>
<variablelist>
<varlistentry>
<term>systemd 252</term>
<listitem><para>Kernel command-line arguments <varname>systemd.unified_cgroup_hierarchy</varname>
and <varname>systemd.legacy_systemd_cgroup_controller</varname> were deprecated. Please switch to
the unified cgroup hierarchy.</para></listitem>
</varlistentry>
</variablelist>
</refsect1> </refsect1>
<refsect1> <refsect1>

View file

@ -340,9 +340,8 @@
that kernel threads do not have a command line, in which case that kernel threads do not have a command line, in which case
-ENXIO is returned.</para> -ENXIO is returned.</para>
<para><function>sd_bus_creds_get_cgroup()</function> will retrieve <para><function>sd_bus_creds_get_cgroup()</function> will retrieve the control group path. See <ulink
the control group path. See <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html">Control Groups v2</ulink>.
url="https://docs.kernel.org/admin-guide/cgroup-v1/index.html">Control Groups version 1</ulink>.
</para> </para>
<para><function>sd_bus_creds_get_unit()</function> will retrieve <para><function>sd_bus_creds_get_unit()</function> will retrieve

View file

@ -45,16 +45,12 @@
one iteration. The <option>--iterations=</option> argument, if one iteration. The <option>--iterations=</option> argument, if
given, is honored. This mode is suitable for scripting.</para> given, is honored. This mode is suitable for scripting.</para>
<para>Resource usage is only accounted for control groups in the <para>Resource usage is only accounted for control groups with the appropriate controllers turned on:
relevant hierarchy, i.e. CPU usage is only accounted for control <literal>cpu</literal> controller for CPU usage, <literal>memory</literal> controller for memory usage,
groups in the <literal>cpuacct</literal> hierarchy, memory usage and <literal>io</literal> contoller for disk I/O consumption. If resource monitoring for these resources
only for those in <literal>memory</literal> and disk I/O usage for is required, it is recommended to add the <varname>CPUAccounting=1</varname>,
those in <literal>blkio</literal>. If resource monitoring for <varname>MemoryAccounting=1</varname> and <varname>IOAccounting=1</varname> settings in the unit files in
these resources is required, it is recommended to add the question. See
<varname>CPUAccounting=1</varname>,
<varname>MemoryAccounting=1</varname> and
<varname>BlockIOAccounting=1</varname> settings in the unit files
in question. See
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details.</para> for details.</para>
@ -63,13 +59,10 @@
the CPU load value is going to be between 0% and 800%. The number of the CPU load value is going to be between 0% and 800%. The number of
processors can be found in <literal>/proc/cpuinfo</literal>.</para> processors can be found in <literal>/proc/cpuinfo</literal>.</para>
<para>To emphasize this: unless <para>To emphasize: unless <literal>CPUAccounting=1</literal>, <literal>MemoryAccounting=1</literal>, and
<literal>CPUAccounting=1</literal>, <literal>IOAccounting=1</literal> are enabled for the services in question, no resource accounting will
<literal>MemoryAccounting=1</literal> and be available for system services and the data shown by <command>systemd-cgtop</command> will be
<literal>BlockIOAccounting=1</literal> are enabled for the incomplete.</para>
services in question, no resource accounting will be available for
system services and the data shown by
<command>systemd-cgtop</command> will be incomplete.</para>
</refsect1> </refsect1>
<refsect1> <refsect1>

View file

@ -448,14 +448,13 @@ Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20.
<example> <example>
<title>Limiting resources available to a command</title> <title>Limiting resources available to a command</title>
<programlisting># systemd-run -p BlockIOWeight=10 updatedb</programlisting> <programlisting># systemd-run -p IOWeight=10 updatedb</programlisting>
<para>This command invokes the <para>This command invokes the <citerefentry
<citerefentry project='man-pages'><refentrytitle>updatedb</refentrytitle><manvolnum>8</manvolnum></citerefentry> project='man-pages'><refentrytitle>updatedb</refentrytitle><manvolnum>8</manvolnum></citerefentry>
tool, but lowers the block I/O weight for it to 10. See tool, but lowers the block I/O weight for it to 10. See
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for more information on the <varname>BlockIOWeight=</varname> for more information on the <varname>IOWeight=</varname> property.</para>
property.</para>
</example> </example>
<example> <example>

View file

@ -437,20 +437,22 @@
<varlistentry> <varlistentry>
<term><varname>DefaultCPUAccounting=</varname></term> <term><varname>DefaultCPUAccounting=</varname></term>
<term><varname>DefaultBlockIOAccounting=</varname></term>
<term><varname>DefaultMemoryAccounting=</varname></term> <term><varname>DefaultMemoryAccounting=</varname></term>
<term><varname>DefaultTasksAccounting=</varname></term> <term><varname>DefaultTasksAccounting=</varname></term>
<term><varname>DefaultIOAccounting=</varname></term> <term><varname>DefaultIOAccounting=</varname></term>
<term><varname>DefaultIPAccounting=</varname></term> <term><varname>DefaultIPAccounting=</varname></term>
<listitem><para>Configure the default resource accounting settings, as configured per-unit by <listitem><para>Configure the default resource accounting settings, as configured per-unit by
<varname>CPUAccounting=</varname>, <varname>BlockIOAccounting=</varname>, <varname>MemoryAccounting=</varname>, <varname>CPUAccounting=</varname>, <varname>MemoryAccounting=</varname>,
<varname>TasksAccounting=</varname>, <varname>IOAccounting=</varname> and <varname>IPAccounting=</varname>. See <varname>TasksAccounting=</varname>, <varname>IOAccounting=</varname> and
<varname>IPAccounting=</varname>. See
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for details on the per-unit settings. <varname>DefaultTasksAccounting=</varname> defaults to yes, for details on the per-unit settings. <varname>DefaultTasksAccounting=</varname> defaults to yes,
<varname>DefaultMemoryAccounting=</varname> to &MEMORY_ACCOUNTING_DEFAULT;. <varname>DefaultCPUAccounting=</varname> <varname>DefaultMemoryAccounting=</varname> to
defaults to yes if enabling CPU accounting doesn't require the CPU controller to be enabled (Linux 4.15+ using the &MEMORY_ACCOUNTING_DEFAULT;. <varname>DefaultCPUAccounting=</varname> defaults to yes if enabling CPU
unified hierarchy for resource control), otherwise it defaults to no. The other three settings default to no.</para></listitem> accounting doesn't require the CPU controller to be enabled (Linux 4.15+ using the unified hierarchy
for resource control), otherwise it defaults to no. The other three settings default to
no.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
@ -590,6 +592,18 @@
</table> </table>
</refsect1> </refsect1>
<refsect1>
<title>History</title>
<variablelist>
<varlistentry>
<term>systemd 252</term>
<listitem><para>Option <varname>DefaultBlockIOAccounting=</varname> was deprecated. Please switch
to the unified cgroup hierarchy.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1> <refsect1>
<title>See Also</title> <title>See Also</title>
<para> <para>

View file

@ -98,60 +98,6 @@
<!-- We don't have any default dependency here. --> <!-- We don't have any default dependency here. -->
<refsect1>
<title>Unified and Legacy Control Group Hierarchies</title>
<para>The unified control group hierarchy is the new version of kernel control group interface, see
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html">Control Groups v2</ulink>.
Depending on the resource type, there are differences in resource control capabilities. Also, because of
interface changes, some resource types have separate set of options on the unified hierarchy.</para>
<para>
<variablelist>
<varlistentry>
<term>CPU</term>
<listitem>
<para><varname>CPUWeight=</varname> and <varname>StartupCPUWeight=</varname> replace
<varname>CPUShares=</varname> and <varname>StartupCPUShares=</varname>, respectively.</para>
<para>The <literal>cpuacct</literal> controller does not exist separately on the unified hierarchy.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Memory</term>
<listitem>
<para><varname>MemoryMax=</varname> replaces <varname>MemoryLimit=</varname>. <varname>MemoryLow=</varname>
and <varname>MemoryHigh=</varname> are effective only on unified hierarchy.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>IO</term>
<listitem>
<para><literal>IO</literal>-prefixed settings are a superset of and replace
<literal>BlockIO</literal>-prefixed ones. On unified hierarchy, IO resource control also applies
to buffered writes.</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>To ease the transition, there is best-effort translation between the two versions of settings. For each
controller, if any of the settings for the unified hierarchy are present, all settings for the legacy hierarchy are
ignored. If the resulting settings are for the other type of hierarchy, the configurations are translated before
application.</para>
<para>Legacy control group hierarchy (see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/">Control Groups version 1</ulink>),
also called cgroup-v1, doesn't allow safe delegation of controllers to unprivileged processes. If the
system uses the legacy control group hierarchy, resource control is disabled for the systemd user
instance, see
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
</refsect1>
<refsect1> <refsect1>
<title>Options</title> <title>Options</title>
@ -205,8 +151,6 @@
<varname>CPUWeight=</varname> applies to normal runtime of the system, and if the former is not set also to <varname>CPUWeight=</varname> applies to normal runtime of the system, and if the former is not set also to
the startup and shutdown phases. Using <varname>StartupCPUWeight=</varname> allows prioritizing specific services at the startup and shutdown phases. Using <varname>StartupCPUWeight=</varname> allows prioritizing specific services at
boot-up and shutdown differently than during normal runtime.</para> boot-up and shutdown differently than during normal runtime.</para>
<para>These settings replace <varname>CPUShares=</varname> and <varname>StartupCPUShares=</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -332,9 +276,6 @@
For details about this control group attribute, see <ulink For details about this control group attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para> url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
<para>This setting is supported only if the unified control group hierarchy is used and disables
<varname>MemoryLimit=</varname>.</para>
<para>Units may have their children use a default <literal>memory.min</literal> or <para>Units may have their children use a default <literal>memory.min</literal> or
<literal>memory.low</literal> value by specifying <varname>DefaultMemoryMin=</varname> or <literal>memory.low</literal> value by specifying <varname>DefaultMemoryMin=</varname> or
<varname>DefaultMemoryLow=</varname>, which has the same semantics as <varname>DefaultMemoryLow=</varname>, which has the same semantics as
@ -361,9 +302,6 @@
special value <literal>infinity</literal>, no memory throttling is applied. This controls the special value <literal>infinity</literal>, no memory throttling is applied. This controls the
<literal>memory.high</literal> control group attribute. For details about this control group attribute, see <literal>memory.high</literal> control group attribute. For details about this control group attribute, see
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para> <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
<para>This setting is supported only if the unified control group hierarchy is used and disables
<varname>MemoryLimit=</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -382,8 +320,6 @@
assigned the special value <literal>infinity</literal>, no memory limit is applied. This controls the assigned the special value <literal>infinity</literal>, no memory limit is applied. This controls the
<literal>memory.max</literal> control group attribute. For details about this control group attribute, see <literal>memory.max</literal> control group attribute. For details about this control group attribute, see
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para> <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
<para>This setting replaces <varname>MemoryLimit=</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -398,9 +334,6 @@
special value <literal>infinity</literal>, no swap limit is applied. This controls the special value <literal>infinity</literal>, no swap limit is applied. This controls the
<literal>memory.swap.max</literal> control group attribute. For details about this control group attribute, <literal>memory.swap.max</literal> control group attribute. For details about this control group attribute,
see <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para> see <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files">Memory Interface Files</ulink>.</para>
<para>This setting is supported only if the unified control group hierarchy is used and disables
<varname>MemoryLimit=</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -427,13 +360,14 @@
<term><varname>TasksMax=<replaceable>N</replaceable></varname></term> <term><varname>TasksMax=<replaceable>N</replaceable></varname></term>
<listitem> <listitem>
<para>Specify the maximum number of tasks that may be created in the unit. This ensures that the number of <para>Specify the maximum number of tasks that may be created in the unit. This ensures that the
tasks accounted for the unit (see above) stays below a specific limit. This either takes an absolute number number of tasks accounted for the unit (see above) stays below a specific limit. This either takes
of tasks or a percentage value that is taken relative to the configured maximum number of tasks on the an absolute number of tasks or a percentage value that is taken relative to the configured maximum
system. If assigned the special value <literal>infinity</literal>, no tasks limit is applied. This controls number of tasks on the system. If assigned the special value <literal>infinity</literal>, no tasks
the <literal>pids.max</literal> control group attribute. For details about this control group attribute, see limit is applied. This controls the <literal>pids.max</literal> control group attribute. For
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v1/pids.html">Process Number Controller</ulink>. details about this control group attribute, the
</para> <ulink url="https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#pid">pids controller
</ulink>.</para>
<para>The system default for this setting may be controlled with <para>The system default for this setting may be controlled with
<varname>DefaultTasksMax=</varname> in <varname>DefaultTasksMax=</varname> in
@ -451,9 +385,6 @@
therein. The system default for this setting may be controlled with <varname>DefaultIOAccounting=</varname> therein. The system default for this setting may be controlled with <varname>DefaultIOAccounting=</varname>
in in
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para> <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<para>This setting replaces <varname>BlockIOAccounting=</varname> and disables settings prefixed with
<varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -477,9 +408,6 @@
the system, and if the former is not set also to the startup the system, and if the former is not set also to the startup
and shutdown phases. This allows prioritizing specific services at boot-up and shutdown phases. This allows prioritizing specific services at boot-up
and shutdown differently than during runtime.</para> and shutdown differently than during runtime.</para>
<para>These settings replace <varname>BlockIOWeight=</varname> and <varname>StartupBlockIOWeight=</varname>
and disable settings prefixed with <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -496,9 +424,6 @@
For details about this control group attribute, see <ulink For details about this control group attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.</para> url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.</para>
<para>This setting replaces <varname>BlockIODeviceWeight=</varname> and disables settings prefixed with
<varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
<para>The specified device node should reference a block device that has an I/O scheduler <para>The specified device node should reference a block device that has an I/O scheduler
associated, i.e. should not refer to partition or loopback block devices, but to the originating, associated, i.e. should not refer to partition or loopback block devices, but to the originating,
physical device. When a path to a regular file or directory is specified it is attempted to physical device. When a path to a regular file or directory is specified it is attempted to
@ -527,10 +452,6 @@
url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>. url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.
</para> </para>
<para>These settings replace <varname>BlockIOReadBandwidth=</varname> and
<varname>BlockIOWriteBandwidth=</varname> and disable settings prefixed with <varname>BlockIO</varname> or
<varname>StartupBlockIO</varname>.</para>
<para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para> <para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -553,9 +474,6 @@
url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>. url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files</ulink>.
</para> </para>
<para>These settings are supported only if the unified control group hierarchy is used and disable settings
prefixed with <varname>BlockIO</varname> or <varname>StartupBlockIO</varname>.</para>
<para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para> <para>Similar restrictions on block device discovery as for <varname>IODeviceWeight=</varname> apply, see above.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -935,11 +853,8 @@ RestrictNetworkInterfaces=~eth1</programlisting>
strings: a device node specifier followed by a combination of <constant>r</constant>, strings: a device node specifier followed by a combination of <constant>r</constant>,
<constant>w</constant>, <constant>m</constant> to control <emphasis>r</emphasis>eading, <constant>w</constant>, <constant>m</constant> to control <emphasis>r</emphasis>eading,
<emphasis>w</emphasis>riting, or creation of the specific device node(s) by the unit <emphasis>w</emphasis>riting, or creation of the specific device node(s) by the unit
(<emphasis>m</emphasis>knod), respectively. On cgroup-v1 this controls the (<emphasis>m</emphasis>knod), respectively. This functionality is implemented using eBPF
<literal>devices.allow</literal> control group attribute. For details about this control group filtering.</para>
attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/devices.html">Device Whitelist Controller</ulink>.
In the unified cgroup hierarchy this functionality is implemented using eBPF filtering.</para>
<para>When access to <emphasis>all</emphasis> physical devices should be disallowed, <para>When access to <emphasis>all</emphasis> physical devices should be disallowed,
<varname>PrivateDevices=</varname> may be used instead. See <varname>PrivateDevices=</varname> may be used instead. See
@ -1189,146 +1104,28 @@ DeviceAllow=/dev/loop-control
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>Deprecated Options</title> <title>History</title>
<para>The following options are deprecated. Use the indicated superseding options instead:</para> <variablelist>
<varlistentry>
<variablelist class='unit-directives'> <term>systemd 252</term>
<listitem><para> Options for controlling the Legacy Control Group Hierarchy (<ulink
<varlistentry> url="https://docs.kernel.org/admin-guide/cgroup-v1/index.html">Control Groups version 1</ulink> are
<term><varname>CPUShares=<replaceable>weight</replaceable></varname></term> now fully deprecated: <varname>CPUShares=<replaceable>weight</replaceable></varname>,
<term><varname>StartupCPUShares=<replaceable>weight</replaceable></varname></term> <varname>StartupCPUShares=<replaceable>weight</replaceable></varname>,
<varname>MemoryLimit=<replaceable>bytes</replaceable></varname>,
<listitem> <varname>BlockIOAccounting=</varname>,
<para>Assign the specified CPU time share weight to the processes executed. These options take an integer <varname>BlockIOWeight=<replaceable>weight</replaceable></varname>,
value and control the <literal>cpu.shares</literal> control group attribute. The allowed range is 2 to <varname>StartupBlockIOWeight=<replaceable>weight</replaceable></varname>,
262144. Defaults to 1024. For details about this control group attribute, see <ulink <varname>BlockIODeviceWeight=<replaceable>device</replaceable>
url="https://docs.kernel.org/scheduler/sched-design-CFS.html">CFS Scheduler</ulink>. <replaceable>weight</replaceable></varname>,
The available CPU time is split up among all units within one slice relative to their CPU time share <varname>BlockIOReadBandwidth=<replaceable>device</replaceable>
weight.</para> <replaceable>bytes</replaceable></varname>,
<varname>BlockIOWriteBandwidth=<replaceable>device</replaceable>
<para>While <varname>StartupCPUShares=</varname> applies to the startup and shutdown phases of the system, <replaceable>bytes</replaceable></varname>.
<varname>CPUShares=</varname> applies to normal runtime of the system, and if the former is not set also to Please switch to the unified cgroup hierarchy.</para></listitem>
the startup and shutdown phases. Using <varname>StartupCPUShares=</varname> allows prioritizing specific services at </varlistentry>
boot-up and shutdown differently than during normal runtime.</para> </variablelist>
<para>Implies <literal>CPUAccounting=yes</literal>.</para>
<para>These settings are deprecated. Use <varname>CPUWeight=</varname> and
<varname>StartupCPUWeight=</varname> instead.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>MemoryLimit=<replaceable>bytes</replaceable></varname></term>
<listitem>
<para>Specify the limit on maximum memory usage of the executed processes. The limit specifies how much
process and kernel memory can be used by tasks in this unit. Takes a memory size in bytes. If the value is
suffixed with K, M, G or T, the specified memory size is parsed as Kilobytes, Megabytes, Gigabytes, or
Terabytes (with the base 1024), respectively. Alternatively, a percentage value may be specified, which is
taken relative to the installed physical memory on the system. If assigned the special value
<literal>infinity</literal>, no memory limit is applied. This controls the
<literal>memory.limit_in_bytes</literal> control group attribute. For details about this control group
attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/memory.html">Memory Resource Controller</ulink>.</para>
<para>Implies <literal>MemoryAccounting=yes</literal>.</para>
<para>This setting is deprecated. Use <varname>MemoryMax=</varname> instead.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlockIOAccounting=</varname></term>
<listitem>
<para>Turn on Block I/O accounting for this unit, if the legacy control group hierarchy is used on the
system. Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
turn it on for all units contained in the same slice and all for its parent slices and the units contained
therein. The system default for this setting may be controlled with
<varname>DefaultBlockIOAccounting=</varname> in
<citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para>
<para>This setting is deprecated. Use <varname>IOAccounting=</varname> instead.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlockIOWeight=<replaceable>weight</replaceable></varname></term>
<term><varname>StartupBlockIOWeight=<replaceable>weight</replaceable></varname></term>
<listitem><para>Set the default overall block I/O weight for the executed processes, if the legacy control
group hierarchy is used on the system. Takes a single weight value (between 10 and 1000) to set the default
block I/O weight. This controls the <literal>blkio.weight</literal> control group attribute, which defaults to
500. For details about this control group attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.
The available I/O bandwidth is split up among all units within one slice relative to their block I/O
weight.</para>
<para>While <varname>StartupBlockIOWeight=</varname> only
applies to the startup and shutdown phases of the system,
<varname>BlockIOWeight=</varname> applies to the later runtime
of the system, and if the former is not set also to the
startup and shutdown phases. This allows prioritizing specific services at
boot-up and shutdown differently than during runtime.</para>
<para>Implies
<literal>BlockIOAccounting=yes</literal>.</para>
<para>These settings are deprecated. Use <varname>IOWeight=</varname> and <varname>StartupIOWeight=</varname>
instead.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlockIODeviceWeight=<replaceable>device</replaceable> <replaceable>weight</replaceable></varname></term>
<listitem>
<para>Set the per-device overall block I/O weight for the executed processes, if the legacy control group
hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to specify
the device specific weight value, between 10 and 1000. (Example: "/dev/sda 500"). The file path may be
specified as path to a block device node or as any other file, in which case the backing block device of the
file system of the file is determined. This controls the <literal>blkio.weight_device</literal> control group
attribute, which defaults to 1000. Use this option multiple times to set weights for multiple devices. For
details about this control group attribute, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.</para>
<para>Implies
<literal>BlockIOAccounting=yes</literal>.</para>
<para>This setting is deprecated. Use <varname>IODeviceWeight=</varname> instead.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>BlockIOReadBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
<term><varname>BlockIOWriteBandwidth=<replaceable>device</replaceable> <replaceable>bytes</replaceable></varname></term>
<listitem>
<para>Set the per-device overall block I/O bandwidth limit for the executed processes, if the legacy control
group hierarchy is used on the system. Takes a space-separated pair of a file path and a bandwidth value (in
bytes per second) to specify the device specific bandwidth. The file path may be a path to a block device
node, or as any other file in which case the backing block device of the file system of the file is used. If
the bandwidth is suffixed with K, M, G, or T, the specified bandwidth is parsed as Kilobytes, Megabytes,
Gigabytes, or Terabytes, respectively, to the base of 1000. (Example:
"/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the
<literal>blkio.throttle.read_bps_device</literal> and <literal>blkio.throttle.write_bps_device</literal>
control group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For
details about these control group attributes, see <ulink
url="https://docs.kernel.org/admin-guide/cgroup-v1/blkio-controller.html">Block IO Controller</ulink>.
</para>
<para>Implies
<literal>BlockIOAccounting=yes</literal>.</para>
<para>These settings are deprecated. Use <varname>IOReadBandwidthMax=</varname> and
<varname>IOWriteBandwidthMax=</varname> instead.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1> </refsect1>
<refsect1> <refsect1>

View file

@ -1576,25 +1576,14 @@
<term><varname>ConditionControlGroupController=</varname></term> <term><varname>ConditionControlGroupController=</varname></term>
<listitem><para>Check whether given cgroup controllers (e.g. <literal>cpu</literal>) are available <listitem><para>Check whether given cgroup controllers (e.g. <literal>cpu</literal>) are available
for use on the system or whether the legacy v1 cgroup or the modern v2 cgroup hierarchy is used. for use on the system.</para>
</para>
<para>Multiple controllers may be passed with a space separating them; in this case the condition <para>Multiple controllers may be passed with a space separating them; in this case the condition
will only pass if all listed controllers are available for use. Controllers unknown to systemd are will only pass if all listed controllers are available for use. Controllers unknown to systemd are
ignored. Valid controllers are <literal>cpu</literal>, <literal>cpuacct</literal>, ignored. Valid controllers are <literal>cpu</literal>, <literal>cpuset</literal>,
<literal>io</literal>, <literal>blkio</literal>, <literal>memory</literal>, <literal>io</literal>, <literal>memory</literal>, and <literal>pids</literal>. Even if available in
<literal>devices</literal>, and <literal>pids</literal>. Even if available in the kernel, a the kernel, a particular controller may not be available if it was disabled on the kernel command
particular controller may not be available if it was disabled on the kernel command line with line with <varname>cgroup_disable=controller</varname>.</para></listitem>
<varname>cgroup_disable=controller</varname>.</para>
<para>Alternatively, two special strings <literal>v1</literal> and <literal>v2</literal> may be
specified (without any controller names). <literal>v2</literal> will pass if the unified v2 cgroup
hierarchy is used, and <literal>v1</literal> will pass if the legacy v1 hierarchy or the hybrid
hierarchy are used (see the discussion of <varname>systemd.unified_cgroup_hierarchy</varname> and
<varname>systemd.legacy_systemd_cgroup_controller</varname> in
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
for more information).</para>
</listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>

View file

@ -207,21 +207,17 @@
memory its accounting data is flushed out too. However, this data is generally not lost, as a journal log record memory its accounting data is flushed out too. However, this data is generally not lost, as a journal log record
is generated declaring the consumed resources whenever a unit shuts down.</para> is generated declaring the consumed resources whenever a unit shuts down.</para>
<para>Processes systemd spawns are placed in individual Linux <para>Processes systemd spawns are placed in individual Linux control groups named after the unit which
control groups named after the unit which they belong to in the they belong to in the private systemd hierarchy. (see <ulink
private systemd hierarchy. (see <ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html">Control Groups v2</ulink> for more information
url="https://docs.kernel.org/admin-guide/cgroup-v1/index.html">Control Groups version 1</ulink> about control groups, or short "cgroups"). systemd uses this to effectively keep track of
for more information about control groups, or short "cgroups"). processes. Control group information is maintained in the kernel, and is accessible via the file system
systemd uses this to effectively keep track of processes. Control hierarchy (beneath <filename>/sys/fs/cgroup/</filename>), or in tools such as <citerefentry
group information is maintained in the kernel, and is accessible project='man-pages'><refentrytitle>systemd-cgls</refentrytitle><manvolnum>1</manvolnum></citerefentry> or
via the file system hierarchy (beneath <citerefentry
<filename>/sys/fs/cgroup/systemd/</filename>), or in tools such as project='man-pages'><refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum></citerefentry> (<command>ps
<citerefentry project='man-pages'><refentrytitle>systemd-cgls</refentrytitle><manvolnum>1</manvolnum></citerefentry> xawf -eo pid,user,cgroup,args</command> is particularly useful to list all processes and the systemd
or units they belong to.).</para>
<citerefentry project='man-pages'><refentrytitle>ps</refentrytitle><manvolnum>1</manvolnum></citerefentry>
(<command>ps xawf -eo pid,user,cgroup,args</command> is
particularly useful to list all processes and the systemd units
they belong to.).</para>
<para>systemd is compatible with the SysV init system to a large <para>systemd is compatible with the SysV init system to a large
degree: SysV init scripts are supported and simply read as an degree: SysV init scripts are supported and simply read as an
@ -910,41 +906,6 @@
for every boot.</para></listitem> for every boot.</para></listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term><varname>systemd.unified_cgroup_hierarchy</varname></term>
<listitem><para>When specified without an argument or with a true argument,
enables the usage of
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v2.html">unified cgroup hierarchy</ulink>
(a.k.a. cgroups-v2). When specified with a false argument, fall back to
hybrid or full legacy cgroup hierarchy.</para>
<para>If this option is not specified, the default behaviour is determined
during compilation (the <option>-Ddefault-hierarchy=</option> meson
option). If the kernel does not support unified cgroup hierarchy, the legacy
hierarchy will be used even if this option is specified.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><varname>systemd.legacy_systemd_cgroup_controller</varname></term>
<listitem><para>Takes effect if the full unified cgroup hierarchy is not used
(see previous option). When specified without an argument or with a true
argument, disables the use of "hybrid" cgroup hierarchy (i.e. a cgroups-v2
tree used for systemd, and
<ulink url="https://docs.kernel.org/admin-guide/cgroup-v1/index.html">legacy
cgroup hierarchy</ulink>, a.k.a. cgroups-v1, for other controllers), and
forces a full "legacy" mode. When specified with a false argument, enables
the use of "hybrid" hierarchy.</para>
<para>If this option is not specified, the default behaviour is determined
during compilation (the <option>-Ddefault-hierarchy=</option> meson
option). If the kernel does not support unified cgroup hierarchy, the legacy
hierarchy will be used even if this option is specified.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term><varname>systemd.set_credential=</varname></term> <term><varname>systemd.set_credential=</varname></term>
@ -1290,6 +1251,19 @@
</variablelist> </variablelist>
</refsect1> </refsect1>
<refsect1>
<title>History</title>
<variablelist>
<varlistentry>
<term>systemd 252</term>
<listitem><para>Kernel command-line arguments <varname>systemd.unified_cgroup_hierarchy</varname>
and <varname>systemd.legacy_systemd_cgroup_controller</varname> were deprecated. Please switch to
the unified cgroup hierarchy.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1> <refsect1>
<title>See Also</title> <title>See Also</title>
<para> <para>

View file

@ -148,12 +148,36 @@ DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_ip_tos, ip_tos, int, -1, "Fai
DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t, "Invalid block IO weight"); DEFINE_CONFIG_PARSE_PTR(config_parse_blockio_weight, cg_blkio_weight_parse, uint64_t, "Invalid block IO weight");
DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight"); DEFINE_CONFIG_PARSE_PTR(config_parse_cg_weight, cg_weight_parse, uint64_t, "Invalid weight");
DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t, "Invalid CPU weight"); DEFINE_CONFIG_PARSE_PTR(config_parse_cg_cpu_weight, cg_cpu_weight_parse, uint64_t, "Invalid CPU weight");
DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares"); static DEFINE_CONFIG_PARSE_PTR(config_parse_cpu_shares_internal, cg_cpu_shares_parse, uint64_t, "Invalid CPU shares");
DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_flags, mount_propagation_flags_from_string, unsigned long, "Failed to parse mount flag"); DEFINE_CONFIG_PARSE_PTR(config_parse_exec_mount_flags, mount_propagation_flags_from_string, unsigned long, "Failed to parse mount flag");
DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1, "Invalid NUMA policy type"); DEFINE_CONFIG_PARSE_ENUM_WITH_DEFAULT(config_parse_numa_policy, mpol, int, -1, "Invalid NUMA policy type");
DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat, "Failed to parse status unit format"); DEFINE_CONFIG_PARSE_ENUM(config_parse_status_unit_format, status_unit_format, StatusUnitFormat, "Failed to parse status unit format");
DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping, "Failed to parse timestamping precision"); DEFINE_CONFIG_PARSE_ENUM_FULL(config_parse_socket_timestamping, socket_timestamping_from_string_harder, SocketTimestamping, "Failed to parse timestamping precision");
int config_parse_cpu_shares(
const char *unit,
const char *filename,
unsigned line,
const char *section,
unsigned section_line,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
assert(filename);
assert(lvalue);
assert(rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Unit uses %s=; please use CPUWeight= instead. Support for %s= will be removed soon.",
lvalue, lvalue);
return config_parse_cpu_shares_internal(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
}
bool contains_instance_specifier_superset(const char *s) { bool contains_instance_specifier_superset(const char *s) {
const char *p, *q; const char *p, *q;
bool percent = false; bool percent = false;
@ -819,9 +843,9 @@ int config_parse_kill_mode(
if (m == KILL_NONE) if (m == KILL_NONE)
log_syntax(unit, LOG_WARNING, filename, line, 0, log_syntax(unit, LOG_WARNING, filename, line, 0,
"Unit configured to use KillMode=none. " "Unit uses KillMode=none. "
"This is unsafe, as it disables systemd's process lifecycle management for the service. " "This is unsafe, as it disables systemd's process lifecycle management for the service. "
"Please update your service to use a safer KillMode=, such as 'mixed' or 'control-group'. " "Please update the service to use a safer KillMode=, such as 'mixed' or 'control-group'. "
"Support for KillMode=none is deprecated and will eventually be removed."); "Support for KillMode=none is deprecated and will eventually be removed.");
*k = m; *k = m;
@ -3914,9 +3938,11 @@ int config_parse_memory_limit(
c->memory_max = bytes; c->memory_max = bytes;
else if (streq(lvalue, "MemorySwapMax")) else if (streq(lvalue, "MemorySwapMax"))
c->memory_swap_max = bytes; c->memory_swap_max = bytes;
else if (streq(lvalue, "MemoryLimit")) else if (streq(lvalue, "MemoryLimit")) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Unit uses MemoryLimit=; please use MemoryMax= instead. Support for MemoryLimit= will be removed soon.");
c->memory_limit = bytes; c->memory_limit = bytes;
else } else
return -EINVAL; return -EINVAL;
return 0; return 0;
@ -4442,6 +4468,10 @@ int config_parse_blockio_device_weight(
assert(lvalue); assert(lvalue);
assert(rvalue); assert(rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Unit uses %s=; please use IO*= settings instead. Support for %s= will be removed soon.",
lvalue, lvalue);
if (isempty(rvalue)) { if (isempty(rvalue)) {
while (c->blockio_device_weights) while (c->blockio_device_weights)
cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights); cgroup_context_free_blockio_device_weight(c, c->blockio_device_weights);
@ -4517,6 +4547,10 @@ int config_parse_blockio_bandwidth(
assert(lvalue); assert(lvalue);
assert(rvalue); assert(rvalue);
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Unit uses %s=; please use IO*= settings instead. Support for %s= will be removed soon.",
lvalue, lvalue);
read = streq("BlockIOReadBandwidth", lvalue); read = streq("BlockIOReadBandwidth", lvalue);
if (isempty(rvalue)) { if (isempty(rvalue)) {

View file

@ -54,7 +54,6 @@
#DefaultCPUAccounting=no #DefaultCPUAccounting=no
#DefaultIOAccounting=no #DefaultIOAccounting=no
#DefaultIPAccounting=no #DefaultIPAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting={{ 'yes' if MEMORY_ACCOUNTING_DEFAULT else 'no' }} #DefaultMemoryAccounting={{ 'yes' if MEMORY_ACCOUNTING_DEFAULT else 'no' }}
#DefaultTasksAccounting=yes #DefaultTasksAccounting=yes
#DefaultTasksMax=15% #DefaultTasksMax=15%