aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Down <chris@chrisdown.name>2018-12-03 14:38:06 +0000
committerChris Down <chris@chrisdown.name>2018-12-03 15:40:31 +0000
commitc72703e26d21cb4994f21ae50c4e18675b02ded3 (patch)
treec2f6cf0b7772548594323b2c98aa6bea387b303e /test
parentcgroup: Traverse leaves to realised cgroup to release controllers (diff)
downloadsystemd-c72703e26d21cb4994f21ae50c4e18675b02ded3.tar.gz
systemd-c72703e26d21cb4994f21ae50c4e18675b02ded3.tar.bz2
systemd-c72703e26d21cb4994f21ae50c4e18675b02ded3.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/meson.build2
-rw-r--r--test/nomem.slice5
-rw-r--r--test/nomemleaf.service9
3 files changed, 16 insertions, 0 deletions
diff --git a/test/meson.build b/test/meson.build
index bf02e39f4..d98bfb80d 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -18,6 +18,8 @@ test_data_files = '''
hwdb/10-bad.hwdb
journal-data/journal-1.txt
journal-data/journal-2.txt
+ nomem.slice
+ nomemleaf.service
parent-deep.slice
parent.slice
sched_idle_bad.service
diff --git a/test/nomem.slice b/test/nomem.slice
new file mode 100644
index 000000000..9c5d208cb
--- /dev/null
+++ b/test/nomem.slice
@@ -0,0 +1,5 @@
+[Unit]
+Description=Nomem Parent Slice
+
+[Slice]
+DisableControllers=memory
diff --git a/test/nomemleaf.service b/test/nomemleaf.service
new file mode 100644
index 000000000..3cbaccb82
--- /dev/null
+++ b/test/nomemleaf.service
@@ -0,0 +1,9 @@
+[Unit]
+Description=Nomem Leaf Service
+
+[Service]
+Slice=nomem.slice
+Type=oneshot
+ExecStart=/bin/true
+IOWeight=200
+MemoryAccounting=true