From 6d48c7cf736ced70c1c2fef1e1f03618911d04bc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 21 Jul 2022 11:19:13 +0200 Subject: [PATCH 1/4] docs: remove documentation about cgroupsv1 settings it's legacy. We'll continue to support it in code, but let's simplify the docs a bit, and not mention this legacy stuff anymore. --- man/kernel-command-line.xml | 2 - man/sd_bus_creds_get_pid.xml | 5 +- man/systemd-cgtop.xml | 27 ++-- man/systemd-run.xml | 9 +- man/systemd-system.conf.xml | 14 +- man/systemd.resource-control.xml | 248 ++----------------------------- man/systemd.unit.xml | 21 +-- man/systemd.xml | 61 ++------ src/core/system.conf.in | 1 - 9 files changed, 50 insertions(+), 338 deletions(-) diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index 99464eb14a..3f5eaf3ef9 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -71,8 +71,6 @@ systemd.default_standard_error= systemd.setenv= systemd.machine_id= - systemd.unified_cgroup_hierarchy - systemd.legacy_systemd_cgroup_controller systemd.set_credential= systemd.import_credentials= diff --git a/man/sd_bus_creds_get_pid.xml b/man/sd_bus_creds_get_pid.xml index 48007f50bd..56cfa4efa5 100644 --- a/man/sd_bus_creds_get_pid.xml +++ b/man/sd_bus_creds_get_pid.xml @@ -340,9 +340,8 @@ that kernel threads do not have a command line, in which case -ENXIO is returned. - sd_bus_creds_get_cgroup() will retrieve - the control group path. See Control Groups version 1. + sd_bus_creds_get_cgroup() will retrieve the control group path. See Control Groups v2. sd_bus_creds_get_unit() will retrieve diff --git a/man/systemd-cgtop.xml b/man/systemd-cgtop.xml index a6d9671952..074eeb246b 100644 --- a/man/systemd-cgtop.xml +++ b/man/systemd-cgtop.xml @@ -45,16 +45,12 @@ one iteration. The argument, if given, is honored. This mode is suitable for scripting. - Resource usage is only accounted for control groups in the - relevant hierarchy, i.e. CPU usage is only accounted for control - groups in the cpuacct hierarchy, memory usage - only for those in memory and disk I/O usage for - those in blkio. If resource monitoring for - these resources is required, it is recommended to add the - CPUAccounting=1, - MemoryAccounting=1 and - BlockIOAccounting=1 settings in the unit files - in question. See + Resource usage is only accounted for control groups with the appropriate controllers turned on: + cpu controller for CPU usage, memory controller for memory usage, + and io contoller for disk I/O consumption. If resource monitoring for these resources + is required, it is recommended to add the CPUAccounting=1, + MemoryAccounting=1 and IOAccounting=1 settings in the unit files in + question. See systemd.resource-control5 for details. @@ -63,13 +59,10 @@ the CPU load value is going to be between 0% and 800%. The number of processors can be found in /proc/cpuinfo. - To emphasize this: unless - CPUAccounting=1, - MemoryAccounting=1 and - BlockIOAccounting=1 are enabled for the - services in question, no resource accounting will be available for - system services and the data shown by - systemd-cgtop will be incomplete. + To emphasize: unless CPUAccounting=1, MemoryAccounting=1, and + IOAccounting=1 are enabled for the services in question, no resource accounting will + be available for system services and the data shown by systemd-cgtop will be + incomplete. diff --git a/man/systemd-run.xml b/man/systemd-run.xml index ab1fb82567..794ff635ed 100644 --- a/man/systemd-run.xml +++ b/man/systemd-run.xml @@ -447,14 +447,13 @@ Sep 08 07:37:21 bupkis env[19948]: BOOT_IMAGE=/vmlinuz-3.11.0-0.rc5.git6.2.fc20. Limiting resources available to a command - # systemd-run -p BlockIOWeight=10 updatedb + # systemd-run -p IOWeight=10 updatedb - This command invokes the - updatedb8 + This command invokes the updatedb8 tool, but lowers the block I/O weight for it to 10. See systemd.resource-control5 - for more information on the BlockIOWeight= - property. + for more information on the IOWeight= property. diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index 065bbd5a64..36f25f94e4 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -437,20 +437,22 @@ DefaultCPUAccounting= - DefaultBlockIOAccounting= DefaultMemoryAccounting= DefaultTasksAccounting= DefaultIOAccounting= DefaultIPAccounting= Configure the default resource accounting settings, as configured per-unit by - CPUAccounting=, BlockIOAccounting=, MemoryAccounting=, - TasksAccounting=, IOAccounting= and IPAccounting=. See + CPUAccounting=, MemoryAccounting=, + TasksAccounting=, IOAccounting= and + IPAccounting=. See systemd.resource-control5 for details on the per-unit settings. DefaultTasksAccounting= defaults to yes, - DefaultMemoryAccounting= to &MEMORY_ACCOUNTING_DEFAULT;. DefaultCPUAccounting= - defaults to yes if enabling CPU 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. + DefaultMemoryAccounting= to + &MEMORY_ACCOUNTING_DEFAULT;. DefaultCPUAccounting= defaults to yes if enabling CPU + 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. diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index c16eb3951a..ba4a14440a 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -98,60 +98,6 @@ - - Unified and Legacy Control Group Hierarchies - - The unified control group hierarchy is the new version of kernel control group interface, see - Control Groups v2. - 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. - - - - - - CPU - - CPUWeight= and StartupCPUWeight= replace - CPUShares= and StartupCPUShares=, respectively. - - The cpuacct controller does not exist separately on the unified hierarchy. - - - - - Memory - - MemoryMax= replaces MemoryLimit=. MemoryLow= - and MemoryHigh= are effective only on unified hierarchy. - - - - - IO - - IO-prefixed settings are a superset of and replace - BlockIO-prefixed ones. On unified hierarchy, IO resource control also applies - to buffered writes. - - - - - - - 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. - - Legacy control group hierarchy (see Control Groups version 1), - 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 - systemd1. - - Options @@ -205,8 +151,6 @@ CPUWeight= applies to normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using StartupCPUWeight= allows prioritizing specific services at boot-up and shutdown differently than during normal runtime. - - These settings replace CPUShares= and StartupCPUShares=. @@ -332,9 +276,6 @@ For details about this control group attribute, see Memory Interface Files. - This setting is supported only if the unified control group hierarchy is used and disables - MemoryLimit=. - Units may have their children use a default memory.min or memory.low value by specifying DefaultMemoryMin= or DefaultMemoryLow=, which has the same semantics as @@ -361,9 +302,6 @@ special value infinity, no memory throttling is applied. This controls the memory.high control group attribute. For details about this control group attribute, see Memory Interface Files. - - This setting is supported only if the unified control group hierarchy is used and disables - MemoryLimit=. @@ -382,8 +320,6 @@ assigned the special value infinity, no memory limit is applied. This controls the memory.max control group attribute. For details about this control group attribute, see Memory Interface Files. - - This setting replaces MemoryLimit=. @@ -398,9 +334,6 @@ special value infinity, no swap limit is applied. This controls the memory.swap.max control group attribute. For details about this control group attribute, see Memory Interface Files. - - This setting is supported only if the unified control group hierarchy is used and disables - MemoryLimit=. @@ -427,13 +360,14 @@ TasksMax=N - Specify the maximum number of tasks that may be created in the unit. This ensures that the number of - tasks accounted for the unit (see above) stays below a specific limit. This either takes an absolute number - of tasks or a percentage value that is taken relative to the configured maximum number of tasks on the - system. If assigned the special value infinity, no tasks limit is applied. This controls - the pids.max control group attribute. For details about this control group attribute, see - Process Number Controller. - + Specify the maximum number of tasks that may be created in the unit. This ensures that the + number of tasks accounted for the unit (see above) stays below a specific limit. This either takes + an absolute number of tasks or a percentage value that is taken relative to the configured maximum + number of tasks on the system. If assigned the special value infinity, no tasks + limit is applied. This controls the pids.max control group attribute. For + details about this control group attribute, the + pids controller + . The system default for this setting may be controlled with DefaultTasksMax= in @@ -451,9 +385,6 @@ therein. The system default for this setting may be controlled with DefaultIOAccounting= in systemd-system.conf5. - - This setting replaces BlockIOAccounting= and disables settings prefixed with - BlockIO or StartupBlockIO. @@ -477,9 +408,6 @@ 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. - - These settings replace BlockIOWeight= and StartupBlockIOWeight= - and disable settings prefixed with BlockIO or StartupBlockIO. @@ -496,9 +424,6 @@ For details about this control group attribute, see IO Interface Files. - This setting replaces BlockIODeviceWeight= and disables settings prefixed with - BlockIO or StartupBlockIO. - 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, 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. - These settings replace BlockIOReadBandwidth= and - BlockIOWriteBandwidth= and disable settings prefixed with BlockIO or - StartupBlockIO. - Similar restrictions on block device discovery as for IODeviceWeight= apply, see above. @@ -553,9 +474,6 @@ url="https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files">IO Interface Files. - These settings are supported only if the unified control group hierarchy is used and disable settings - prefixed with BlockIO or StartupBlockIO. - Similar restrictions on block device discovery as for IODeviceWeight= apply, see above. @@ -935,11 +853,8 @@ RestrictNetworkInterfaces=~eth1 strings: a device node specifier followed by a combination of r, w, m to control reading, writing, or creation of the specific device node(s) by the unit - (mknod), respectively. On cgroup-v1 this controls the - devices.allow control group attribute. For details about this control group - attribute, see Device Whitelist Controller. - In the unified cgroup hierarchy this functionality is implemented using eBPF filtering. + (mknod), respectively. This functionality is implemented using eBPF + filtering. When access to all physical devices should be disallowed, PrivateDevices= may be used instead. See @@ -1188,149 +1103,6 @@ DeviceAllow=/dev/loop-control - - Deprecated Options - - The following options are deprecated. Use the indicated superseding options instead: - - - - - CPUShares=weight - StartupCPUShares=weight - - - Assign the specified CPU time share weight to the processes executed. These options take an integer - value and control the cpu.shares control group attribute. The allowed range is 2 to - 262144. Defaults to 1024. For details about this control group attribute, see CFS Scheduler. - The available CPU time is split up among all units within one slice relative to their CPU time share - weight. - - While StartupCPUShares= applies to the startup and shutdown phases of the system, - CPUShares= applies to normal runtime of the system, and if the former is not set also to - the startup and shutdown phases. Using StartupCPUShares= allows prioritizing specific services at - boot-up and shutdown differently than during normal runtime. - - Implies CPUAccounting=yes. - - These settings are deprecated. Use CPUWeight= and - StartupCPUWeight= instead. - - - - - MemoryLimit=bytes - - - 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 - infinity, no memory limit is applied. This controls the - memory.limit_in_bytes control group attribute. For details about this control group - attribute, see Memory Resource Controller. - - Implies MemoryAccounting=yes. - - This setting is deprecated. Use MemoryMax= instead. - - - - - BlockIOAccounting= - - - 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 - DefaultBlockIOAccounting= in - systemd-system.conf5. - - This setting is deprecated. Use IOAccounting= instead. - - - - - BlockIOWeight=weight - StartupBlockIOWeight=weight - - 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 blkio.weight control group attribute, which defaults to - 500. For details about this control group attribute, see Block IO Controller. - The available I/O bandwidth is split up among all units within one slice relative to their block I/O - weight. - - While StartupBlockIOWeight= only - applies to the startup and shutdown phases of the system, - BlockIOWeight= 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. - - Implies - BlockIOAccounting=yes. - - These settings are deprecated. Use IOWeight= and StartupIOWeight= - instead. - - - - - - BlockIODeviceWeight=device weight - - - 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 blkio.weight_device 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 Block IO Controller. - - Implies - BlockIOAccounting=yes. - - This setting is deprecated. Use IODeviceWeight= instead. - - - - - BlockIOReadBandwidth=device bytes - BlockIOWriteBandwidth=device bytes - - - 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 - blkio.throttle.read_bps_device and blkio.throttle.write_bps_device - control group attributes. Use this option multiple times to set bandwidth limits for multiple devices. For - details about these control group attributes, see Block IO Controller. - - - Implies - BlockIOAccounting=yes. - - These settings are deprecated. Use IOReadBandwidthMax= and - IOWriteBandwidthMax= instead. - - - - - - See Also diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index ea95ba8869..c7def6bdcb 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -1575,25 +1575,14 @@ ConditionControlGroupController= Check whether given cgroup controllers (e.g. cpu) 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. 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 - ignored. Valid controllers are cpu, cpuacct, - io, blkio, memory, - devices, and pids. Even if available in the kernel, a - particular controller may not be available if it was disabled on the kernel command line with - cgroup_disable=controller. - - Alternatively, two special strings v1 and v2 may be - specified (without any controller names). v2 will pass if the unified v2 cgroup - hierarchy is used, and v1 will pass if the legacy v1 hierarchy or the hybrid - hierarchy are used (see the discussion of systemd.unified_cgroup_hierarchy and - systemd.legacy_systemd_cgroup_controller in - systemd.service5 - for more information). - + ignored. Valid controllers are cpu, cpuset, + io, memory, and pids. Even if available in + the kernel, a particular controller may not be available if it was disabled on the kernel command + line with cgroup_disable=controller. diff --git a/man/systemd.xml b/man/systemd.xml index 30484e09a9..d19318929a 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -207,21 +207,17 @@ 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. - Processes systemd spawns are placed in individual Linux - control groups named after the unit which they belong to in the - private systemd hierarchy. (see Control Groups version 1 - for more information about control groups, or short "cgroups"). - systemd uses this to effectively keep track of processes. Control - group information is maintained in the kernel, and is accessible - via the file system hierarchy (beneath - /sys/fs/cgroup/systemd/), or in tools such as - systemd-cgls1 - or - ps1 - (ps xawf -eo pid,user,cgroup,args is - particularly useful to list all processes and the systemd units - they belong to.). + Processes systemd spawns are placed in individual Linux control groups named after the unit which + they belong to in the private systemd hierarchy. (see Control Groups v2 for more information + about control groups, or short "cgroups"). systemd uses this to effectively keep track of + processes. Control group information is maintained in the kernel, and is accessible via the file system + hierarchy (beneath /sys/fs/cgroup/), or in tools such as systemd-cgls1 or + ps1 (ps + xawf -eo pid,user,cgroup,args is particularly useful to list all processes and the systemd + units they belong to.). systemd is compatible with the SysV init system to a large degree: SysV init scripts are supported and simply read as an @@ -910,41 +906,6 @@ for every boot. - - systemd.unified_cgroup_hierarchy - - When specified without an argument or with a true argument, - enables the usage of - unified cgroup hierarchy - (a.k.a. cgroups-v2). When specified with a false argument, fall back to - hybrid or full legacy cgroup hierarchy. - - If this option is not specified, the default behaviour is determined - during compilation (the meson - option). If the kernel does not support unified cgroup hierarchy, the legacy - hierarchy will be used even if this option is specified. - - - - - systemd.legacy_systemd_cgroup_controller - - 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 - legacy - cgroup hierarchy, 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. - - If this option is not specified, the default behaviour is determined - during compilation (the meson - option). If the kernel does not support unified cgroup hierarchy, the legacy - hierarchy will be used even if this option is specified. - - - systemd.set_credential= diff --git a/src/core/system.conf.in b/src/core/system.conf.in index 318c034826..a4e79d3033 100644 --- a/src/core/system.conf.in +++ b/src/core/system.conf.in @@ -54,7 +54,6 @@ #DefaultCPUAccounting=no #DefaultIOAccounting=no #DefaultIPAccounting=no -#DefaultBlockIOAccounting=no #DefaultMemoryAccounting={{ 'yes' if MEMORY_ACCOUNTING_DEFAULT else 'no' }} #DefaultTasksAccounting=yes #DefaultTasksMax=15% From 7a9e0bd031d9cda757e0569d4ff6b5ae1a59d40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 23 Aug 2022 09:11:23 +0200 Subject: [PATCH 2/4] man: add "History" sections for removed settings The general idea is that users should be able to figure out if some option that they see in a config file or on some internet page is something that systemd knows about. Once users know that, yes, this was an option but has been deprecated and removed from the documentation, it's much easier for them to find any docs in old versions if they want to. Or to switch to something different. --- man/kernel-command-line.xml | 12 ++++++++++++ man/systemd-system.conf.xml | 12 ++++++++++++ man/systemd.resource-control.xml | 25 +++++++++++++++++++++++++ man/systemd.xml | 13 +++++++++++++ 4 files changed, 62 insertions(+) diff --git a/man/kernel-command-line.xml b/man/kernel-command-line.xml index 3f5eaf3ef9..c648f7779e 100644 --- a/man/kernel-command-line.xml +++ b/man/kernel-command-line.xml @@ -557,7 +557,19 @@ the hostname, it simply controls the initial hostname set during early boot. + + + History + + + + systemd 252 + Kernel command-line arguments systemd.unified_cgroup_hierarchy + and systemd.legacy_systemd_cgroup_controller were deprecated. Please switch to + the unified cgroup hierarchy. + + diff --git a/man/systemd-system.conf.xml b/man/systemd-system.conf.xml index 36f25f94e4..ac21c31d9a 100644 --- a/man/systemd-system.conf.xml +++ b/man/systemd-system.conf.xml @@ -592,6 +592,18 @@ + + History + + + + systemd 252 + Option DefaultBlockIOAccounting= was deprecated. Please switch + to the unified cgroup hierarchy. + + + + See Also diff --git a/man/systemd.resource-control.xml b/man/systemd.resource-control.xml index ba4a14440a..940395a442 100644 --- a/man/systemd.resource-control.xml +++ b/man/systemd.resource-control.xml @@ -1103,6 +1103,31 @@ DeviceAllow=/dev/loop-control + + History + + + + systemd 252 + Options for controlling the Legacy Control Group Hierarchy (Control Groups version 1 are + now fully deprecated: CPUShares=weight, + StartupCPUShares=weight, + MemoryLimit=bytes, + BlockIOAccounting=, + BlockIOWeight=weight, + StartupBlockIOWeight=weight, + BlockIODeviceWeight=device + weight, + BlockIOReadBandwidth=device + bytes, + BlockIOWriteBandwidth=device + bytes. + Please switch to the unified cgroup hierarchy. + + + + See Also diff --git a/man/systemd.xml b/man/systemd.xml index d19318929a..99b6f11b90 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -1251,6 +1251,19 @@ + + History + + + + systemd 252 + Kernel command-line arguments systemd.unified_cgroup_hierarchy + and systemd.legacy_systemd_cgroup_controller were deprecated. Please switch to + the unified cgroup hierarchy. + + + + See Also From c1e701e2f1ecc0c86cfc546b7c92945de1a2bba1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 21 Jul 2022 11:28:30 +0200 Subject: [PATCH 3/4] pid1: generate warnings if old obsolete cgroupsv1 settings are used --- src/core/load-fragment.c | 40 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 0a2d4d4035..23ddbd0940 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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_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_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_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_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) { const char *p, *q; bool percent = false; @@ -3914,9 +3938,11 @@ int config_parse_memory_limit( c->memory_max = bytes; else if (streq(lvalue, "MemorySwapMax")) 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; - else + } else return -EINVAL; return 0; @@ -4442,6 +4468,10 @@ int config_parse_blockio_device_weight( assert(lvalue); 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)) { while (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(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); if (isempty(rvalue)) { From af9d5d507aae7e037739139931350ea5573fdeff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 23 Aug 2022 09:22:24 +0200 Subject: [PATCH 4/4] pid1: shorten advice message --- src/core/load-fragment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 23ddbd0940..6a7390a6f0 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -843,9 +843,9 @@ int config_parse_kill_mode( if (m == KILL_NONE) 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. " - "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."); *k = m;