[jdk8u-dev] RFR: 8292541: [Metrics] Reported memory limit may exceed physical machine memory

Severin Gehwolf sgehwolf at openjdk.org
Fri Jan 13 13:00:36 UTC 2023


On Tue, 3 Jan 2023 11:46:29 GMT, Jonathan Dowland <jdowland at openjdk.org> wrote:

> This is a backport of JDK-8292541 to jdk8u-dev as part of cgroups v2 support.
> 
> It's not clean: two separate fix ups were needed for 8u which are broken out in separate commits: add the new JNI method name to a mapfile; fully qualify the use of a method name in the test.
> 
> the edited test passes for me.

jdk/src/linux/native/jdk/internal/platform/cgroupv1/CgroupMetrics.c line 42:

> 40:   (JNIEnv *env, jclass ignored)
> 41: {
> 42:     return sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE);

According to my experiments changing this to:


    jlong page_size = sysconf(_SC_PAGESIZE);
    jlong pages = sysconf(_SC_PHYS_PAGES);
    return pages * page_size;


fixes the test issue on x86 (32 bit). As this is an issue with the upstream patch, I suggest to file an upstream bug to get it fixed as we'll likely have missed the issue on later JDKs (no testing happens on x86 AFAIK).

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

PR: https://git.openjdk.org/jdk8u-dev/pull/220


More information about the jdk8u-dev mailing list