[jdk11u-dev] RFR: 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy

Severin Gehwolf sgehwolf at openjdk.java.net
Thu Mar 10 19:17:46 UTC 2022


On Tue, 8 Mar 2022 18:47:32 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

> This is a followup backport for Cgroup v2 support.
> 
> The original patch does not apply cleanly, due to context differences and some of out-of-order backports, conflicts were resolved manually.
> 
> In additional:
> 
> 1) Include partial backport of JDK-8250627.
>     - Renamed `Metrics.c` =>  `CgroupMetrics.c`
>     - Added native method `isUseContainerSupport()` to `CgroupMetrics.java`
>     - Return instance only if `isUseContainerSupport()` is enabled.
>    
> 2) Add `createTempDirectory()` method to `test/lib/jdk/test/lib/Utils.java` for `TestCgroupSubsystemController.java` test
> 
> 3) Add `import jdk.test.lib.process.OutputAnalyzer;` to `TestDockerMemoryMetrics.java`
> 
> Test:
> 
> - [x] jtreg containers/docker test on Ubuntu 20.04.4 LTS
> - [x] jdk/internal/platform/cgroup on Ubuntu 20.04.4 LTS
> - [x] jdk/internal/platform/docker on Ubuntu 20.04.4 LTS

A few more comments related to: https://bugs.openjdk.java.net/browse/JDK-8250984

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 442:

> 440:     public long getMemoryAndSwapFailCount() {
> 441:         return getLongValue(memory, "memory.memsw.failcnt");
> 442:     }

This is missing the hunk for https://bugs.openjdk.java.net/browse/JDK-8250984. See:
https://github.com/openjdk/jdk11u-dev/blob/87703322e980e42035d7cf101f04cafdc31fe278/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java#L480..L482

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 445:

> 443: 
> 444:     public long getMemoryAndSwapLimit() {
> 445:         long retval = getLongValue(memory, "memory.memsw.limit_in_bytes");

This is missing the hunk for https://bugs.openjdk.java.net/browse/JDK-8250984. See:
https://github.com/openjdk/jdk11u-dev/blob/87703322e980e42035d7cf101f04cafdc31fe278/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java#L487..L489

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 460:

> 458: 
> 459:     public long getMemoryAndSwapMaxUsage() {
> 460:         return getLongValue(memory, "memory.memsw.max_usage_in_bytes");

This is missing the hunk for https://bugs.openjdk.java.net/browse/JDK-8250984. See:
https://github.com/openjdk/jdk11u-dev/blob/87703322e980e42035d7cf101f04cafdc31fe278/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java#L506..L508

src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 464:

> 462: 
> 463:     public long getMemoryAndSwapUsage() {
> 464:         return getLongValue(memory, "memory.memsw.usage_in_bytes");

This is missing the hunk for https://bugs.openjdk.java.net/browse/JDK-8250984. See:
https://github.com/openjdk/jdk11u-dev/blob/87703322e980e42035d7cf101f04cafdc31fe278/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/Metrics.java#L513..L515

-------------

Changes requested by sgehwolf (Reviewer).

PR: https://git.openjdk.java.net/jdk11u-dev/pull/863


More information about the jdk-updates-dev mailing list