Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8230305 Cgroups v2: Container awareness
  3. JDK-8231111

Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy

    XMLWordPrintable

Details

    • b11
    • generic
    • linux

    Backports

      Description

        Currently, the Linux-only Metrics class in jdk/internal/platform/Metrics.java hard-codes cgroups version 1:

            /**
             * Returns an instance of the Metrics class.
             *
             * @return Metrics object or null if not supported on this platform.
             */
            public static Metrics systemMetrics() {
                try {
                    // We currently only support cgroupv1
                    Class<?> c = Class.forName("jdk.internal.platform.cgroupv1.Metrics");
                [...]
             }

        For the cgroups v2 effort this needs to be reworked.

        On a F31 system with unified hierarchy only, java -XshowSettings:system look like this:

        $ bin/java -XshowSettings:system -version
        Operating System Metrics:
            No metrics available for this platform
        openjdk version "14-internal" 2020-03-17
        OpenJDK Runtime Environment (fastdebug build 14-internal+0-adhoc.sgehwolf.jdk-jdk)
        OpenJDK 64-Bit Server VM (fastdebug build 14-internal+0-adhoc.sgehwolf.jdk-jdk, mixed mode, sharing)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: