Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8347811

Container detection code for cgroups v2 should use cgroup.controllers

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P3 P3
    • tbd
    • 17.0.15, 24, 25
    • hotspot
    • 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.

            sgehwolf Severin Gehwolf
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: