On Wed, 2019-09-18 at 11:07 -0700, Bob Vandette wrote: > Do you handle the case where there are v1 and v2 subsystems enabled at the > same time?
Do you mean hybrid hierarchy? I believe so, yes. Right now, if cpu/cpuset/memory/cpuacct controllers are not bound to a cgroupv1 hierarchy - 0 of the hierarchy field in /proc/cgroups (see man 7 cgroups) - cgroupv2 is being assumed. For hybrid hiearchy, which is pretty common with systemd, this would detect to cgroupv1. It's all or nothing for relevant controllers, though. Either all of them are cgroups v1 or all of them are cgroups v2. Examples: hybrid hierarchy (note cgroup2 mounted at /sys/fs/cgroup/unified): ---------------------------------------------------- $ grep cgroup /proc/self/mountinfo 28 21 0:25 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:4 - tmpfs tmpfs ro,seclabel,mode=755 29 28 0:26 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:5 - cgroup2 cgroup2 rw,seclabel,nsdelegate 30 28 0:27 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,seclabel,xattr,name=systemd 33 28 0:30 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:7 - cgroup cgroup rw,seclabel,blkio 34 28 0:31 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,seclabel,cpuset 35 28 0:32 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,seclabel,net_cls,net_prio 36 28 0:33 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,seclabel,cpu,cpuacct 37 28 0:34 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,seclabel,devices 38 28 0:35 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,seclabel,hugetlb 39 28 0:36 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,seclabel,pids 40 28 0:37 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,seclabel,memory 41 28 0:38 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,seclabel,freezer 42 28 0:39 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,seclabel,perf_event $ bin/java -Xlog:os+container=trace -version | grep Detected [0.003s][debug][os,container] Detected cgroups hybrid or legacy hierarchy, using cgroups v1 controllers openjdk version "14-internal" 2020-03-17 OpenJDK Runtime Environment (fastdebug build 14-internal+0-adhoc.sgehwolf.openjdk-head) OpenJDK 64-Bit Server VM (fastdebug build 14-internal+0-adhoc.sgehwolf.openjdk-head, mixed mode, sharing) unified hierarchy: ---------------------------------------------------- $ grep cgroup /proc/self/mountinfo 28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 cgroup2 rw,seclabel $ bin/java -Xlog:os+container=trace -version | grep Detected [0.001s][debug][os,container] Detected cgroups v2 unified hierarchy openjdk version "14-internal" 2020-03-17 OpenJDK Runtime Environment (fastdebug build 14-internal+0-adhoc.sgehwolf.openjdk-head) OpenJDK 64-Bit Server VM (fastdebug build 14-internal+0-adhoc.sgehwolf.openjdk-head, mixed mode, sharing) Thanks, Severin