On Mon, 23 Nov 2020 15:46:56 GMT, Severin Gehwolf <sgehw...@openjdk.org> wrote:
> This is an enhancement which solves two issues: > > 1. Multiple reads of relevant cgroup interface files. Now interface files are > only read once per file (just like Hotspot). > 2. Proxies creation of the impl specific subsystem via `determineType()` as > before, but now reads all relevant interface files: `/proc/cgroups`, > `/proc/self/mountinfo` and `/proc/self/cgroup`. Once read it passes the > parsed information to the impl specific subsystem classes for instantiation. > This allows for more flexibility of testing as interface files can be mocked > and, thus, more cases can be tested that way without having access to these > specific systems. For example, proper regression tests for JDK-8217766 and > JDK-8253435 have been added now with this in place. > > * [x] Tested on Linux x86_64 on cgroups v1 and cgroups v2. Container tests > pass. test/jdk/jdk/internal/platform/cgroup/TestCgroupSubsystemFactory.java line 238: > 236: assertFalse("Join controller combination expected as cgroups > v1", res.isCgroupV2()); > 237: CgroupInfo memoryInfo = res.getInfos().get("memory"); > 238: assertEquals("/user.slice/user-1000.slice/session-3.scope", > memoryInfo.getCgroupPath()); The gist of the Java equivalent of JDK-8253939 (which fixed this for Hotspot). I.e. a regression test for JDK-8217766 and JDK-8254854. test/jdk/jdk/internal/platform/cgroup/TestCgroupSubsystemFactory.java line 267: > 265: assertFalse("Duplicate cpusets should not influence detection > heuristic", res.isCgroupV2()); > 266: CgroupInfo cpuSetInfo = res.getInfos().get("cpuset"); > 267: assertEquals("/sys/fs/cgroup/cpuset", > cpuSetInfo.getMountPoint()); We can now assert the proper mount point is being used for multiple cpuset mounts. ------------- PR: https://git.openjdk.java.net/jdk/pull/1393