Container detection code for cgroups v2 should use cgroup.controllers

XMLWordPrintable

    • b18
    • generic
    • linux

        The kernel admin guide for cgroups v2 lists the /proc/cgroups file as meaningless for cg v2:

        https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#deprecated-v1-core-features

        """
        /proc/cgroups is meaningless for v2. Use “cgroup.controllers” or “cgroup.stat” files at the root instead
        """

        The OpenJDK container detection code still uses the deprecated feature '/proc/cgroups' and should migrate to '/sys/fs/cgroup/cgroup.subtree_control' instead for cg v2 in order to detect enabled controllers.

        https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#controlling-controllers mentions that the 'cgroup.controllers' file lists all available controllers for a hierarchy. However, for the purposes of the JVM we are interested in *enabled* controllers for the hierarchy. In the JVM case the hierarchy is /sys/fs/cgroup. *Enabled* controllers for a hierarchy are listed in '/sys/fs/cgroup/cgroup.subtree_control' with the same format than 'cgroup.controllers' file.

              Assignee:
              Severin Gehwolf
              Reporter:
              Severin Gehwolf
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: