]> git.ipfire.org Git - thirdparty/systemd.git/commit
cgroup: Add EffectiveMemoryMax=, EffectiveMemoryHigh= and EffectiveTasksMax= properties
authorMichal Koutný <mkoutny@suse.com>
Fri, 11 Aug 2023 11:51:20 +0000 (13:51 +0200)
committerMichal Koutný <mkoutny@suse.com>
Wed, 3 Jan 2024 12:37:08 +0000 (13:37 +0100)
commit4fb0d2dc140c9a2c01c236d2a8dc09a44157e896
treed56df1de6c56028af59212ad96667e53009d3fe2
parentbc9e592c4f01dd8a4f8fb5e2bbcdec5ee4bf129d
cgroup: Add EffectiveMemoryMax=, EffectiveMemoryHigh= and EffectiveTasksMax= properties

Users become perplexed when they run their workload in a unit with no
explicit limits configured (moreover, listing the limit property would
even show it's infinity) but they experience unexpected resource
limitation.

The memory and pid limits come as the most visible, therefore add new
unit read-only properties:
- EffectiveMemoryMax=,
- EffectiveMemoryHigh=,
- EffectiveTasksMax=.

These properties represent the most stringent limit systemd is aware of
for the given unit -- and that is typically(*) the effective value.

Implement the properties by simply traversing all parents in the
leaf-slice tree and picking the minimum value. Note that effective
limits are thus defined even for units that don't enable explicit
accounting (because of the hierarchy).

(*) The evasive case is when systemd runs in a cgroupns and cannot
reason about outer setup. Complete solution would need kernel support.
man/org.freedesktop.systemd1.xml
man/systemd.resource-control.xml
src/core/cgroup.c
src/core/cgroup.h
src/core/dbus-unit.c
src/shared/bus-print-properties.c