[8u] RFR: 8265836: OperatingSystemImpl.getCpuLoad() returns incorrect CPU load inside a container

Severin Gehwolf sgehwolf at redhat.com
Tue Jul 13 17:05:39 UTC 2021


Hi,

Please review this fix for cpu load reporting via the
OperatingSystemMXBean inside containers. With JDK-8226575[1] that mbean
has been made container aware and should therefore also report cpu load
according to the container settings. It currently reports incorrect
values. The backport depends on a backport of JDK-8247469, which has
been proposed here (already reviewed by Andrew Dinn):

https://mail.openjdk.java.net/pipermail/jdk8u-dev/2021-July/014106.html

The OpenJDK 11u patch doesn't apply cleanly since there have been
various refactorings in this area in later JDKs. The meat of the patch
is largely the same, though.

In particular changes to UnixOperatingSystem.c in JDK 11 have been done
in LinuxOperatingSystem.c in 8u, the package name in 8u is
sun.management over com.sun.management.internal (in 11u). Finally, the
new native method needs an entry in mapfile-vers.

Bug: https://bugs.openjdk.java.net/browse/JDK-8265836
webrev: https://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8265836/jdk8/01/webrev/

Testing: Builds on Linux x86_64, Solaris Sparc, AIX. Tier 1 tests, no
         new regressions. Manual testing with the reproducer of the
         bug.

Thoughts?

Thanks,
Severin

[1] https://bugs.openjdk.java.net/browse/JDK-8226575



More information about the jdk8u-dev mailing list