On Thu, 25 Aug 2022 10:07:15 GMT, Jonathan Dowland <jdowl...@openjdk.org> wrote:
>> When the container memory exceeds the physical host's memory, the Java >> metrics reporting is wrong. >> >> https://bugs.openjdk.org/browse/JDK-8292541 >> >> This is the equivalent core-libs fix for Hotspot's >> [JDK-8292083](https://bugs.openjdk.org/browse/JDK-8292083) >> (https://github.com/openjdk/jdk/pull/9880) > > Jonathan Dowland has updated the pull request incrementally with one > additional commit since the last revision: > > avoid calling subsystem.getMemoryLimit twice src/java.base/linux/classes/jdk/internal/platform/CgroupMetrics.java line 126: > 124: long subs_mem = subsystem.getMemoryLimit(); > 125: // catch the cgroup memory limit exceeding host physical memory. > 126: // treat this as unlimited. nit: Start sentences uppercase src/java.base/linux/native/libjava/CgroupMetrics.c line 41: > 39: Java_jdk_internal_platform_CgroupMetrics_getTotalMemorySize0 > 40: (JNIEnv *env, jclass ignored) > 41: { Why not do it the same way hotspot does? sysinfo(&si); avail_mem = (julong)si.freeram * si.mem_unit; if for some weird reason the APIs return different numbers, at least we use the same numbers in JDK and VM. ------------- PR: https://git.openjdk.org/jdk/pull/10017