-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Description
systemd version the issue has been seen with
HEAD
Used distribution
Arch Linux
Expected behaviour you didn't see
If JoinController=x,y is set and we set CGROUP_MASK_X for a unit, the unit is still added to the x,y hierarchy with its own service cgroup.
Unexpected behaviour you saw
If JoinController=x,y is set and we set CGROUP_MASK_X for a unit, the unit gets put in the wrong cgroup in the x,y hierarchy (its slice parent).
Steps to reproduce the problem
See #10507 (comment) for where this was found:
- Use hybrid hierarchy
- Set
JoinControllers=cpu,cpuacct(part of the default) - Change systemd code so it only applies
CGROUP_MASK_CPUforCPUSharesin src/core/cgroup.c in cgroup_context_has_cpu_weight/cgroup_context_has_cpu_shares check at the top of cgroup_context_get_mask systemd-run -p CPUShares=100 sleep infinity- Look at cgroups for
sleep infinityprocess (see cpu,cpuacct hierarchy where we've been placed in parent slice):
12:pids:/system.slice/run-r2969b148d2cd4305989b0573144eb674.service
11:blkio:/
10:cpu,cpuacct:/system.slice
9:devices:/system.slice/run-r2969b148d2cd4305989b0573144eb674.service
8:net_cls,net_prio:/
7:freezer:/
6:hugetlb:/
5:cpuset:/
4:rdma:/
3:memory:/system.slice/run-r2969b148d2cd4305989b0573144eb674.service
2:perf_event:/
1:name=systemd:/system.slice/run-r2969b148d2cd4305989b0573144eb674.service
0::/system.slice/run-r2969b148d2cd4305989b0573144eb674.service
My guess is that this deficiency went unnoticed because we only usually apply cpuacct and cpu together in old code, and net_cls/net_prio was not so commonly exercised independently either.