This is a fix for https://bugs.openjdk.org/browse/JDK-8300119 (CgroupMetrics.getTotalMemorySize0() can report invalid results on 32 bit systems). Thanks to @jerboaa Severin Gehwolf for figuring out the solution.
The problem is demonstrated by test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java which fails on 32-bit x86 in HEAD, and passes after applying this patch. I tested this on an amd64 system with a cross-compiled JDK. I needed to override the default docker container for the test, to get one with a 32-bit userland. (the precise choice was also dictated by ABI matching my main development machine): $JT_HOME/bin/jtreg -v -Djdk.test.docker.retain.image=true -Djdk.test.docker.image.name=i386/debian -Djdk.test.docker.image.version=testing-slim -jdk:$JAVA_HOME test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java ------------- Commit messages: - 8300119: CgroupMetrics.getTotalMemorySize0() can report invalid results on 32 bit systems Changes: https://git.openjdk.org/jdk/pull/12069/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12069&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8300119 Stats: 3 lines in 1 file changed: 2 ins; 0 del; 1 mod Patch: https://git.openjdk.org/jdk/pull/12069.diff Fetch: git fetch https://git.openjdk.org/jdk pull/12069/head:pull/12069 PR: https://git.openjdk.org/jdk/pull/12069