]> git.ipfire.org Git - thirdparty/systemd.git/commit
cgroup: Add DisableControllers= directive to disable controller in subtree 10567/head
authorChris Down <chris@chrisdown.name>
Mon, 3 Dec 2018 14:38:06 +0000 (14:38 +0000)
committerChris Down <chris@chrisdown.name>
Mon, 3 Dec 2018 15:40:31 +0000 (15:40 +0000)
commitc72703e26d21cb4994f21ae50c4e18675b02ded3
treec2f6cf0b7772548594323b2c98aa6bea387b303e
parent4f6f62e468db358a25abf51668c881105b35dc24
cgroup: Add DisableControllers= directive to disable controller in subtree

Some controllers (like the CPU controller) have a performance cost that
is non-trivial on certain workloads. While this can be mitigated and
improved to an extent, there will for some controllers always be some
overheads associated with the benefits gained from the controller.
Inside Facebook, the fix applied has been to disable the CPU controller
forcibly with `cgroup_disable=cpu` on the kernel command line.

This presents a problem: to disable or reenable the controller, a reboot
is required, but this is quite cumbersome and slow to do for many
thousands of machines, especially machines where disabling/enabling a
stateful service on a machine is a matter of several minutes.

Currently systemd provides some configuration knobs for these in the
form of `[Default]CPUAccounting`, `[Default]MemoryAccounting`, and the
like. The limitation of these is that Default*Accounting is overrideable
by individual services, of which any one could decide to reenable a
controller within the hierarchy at any point just by using a controller
feature implicitly (eg. `CPUWeight`), even if the use of that CPU
feature could just be opportunistic. Since many services are provided by
the distribution, or by upstream teams at a particular organisation,
it's not a sustainable solution to simply try to find and remove
offending directives from these units.

This commit presents a more direct solution -- a DisableControllers=
directive that forcibly disallows a controller from being enabled within
a subtree.
man/systemd.resource-control.xml
src/core/cgroup.c
src/core/cgroup.h
src/core/dbus-cgroup.c
src/core/load-fragment-gperf.gperf.m4
src/core/load-fragment.c
src/core/load-fragment.h
src/test/test-cgroup-mask.c
test/meson.build
test/nomem.slice [new file with mode: 0644]
test/nomemleaf.service [new file with mode: 0644]