[jdk17u-dev] RFR: 8349988: Change cgroup version detection logic to not depend on /proc/cgroups

Jonathan Dowland jdowland at openjdk.org
Tue Feb 24 10:48:15 UTC 2026


On Mon, 16 Feb 2026 20:27:31 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

> Please review this backport of the cgroup version detection logic which affects JDK 17 as well. Newer systems which are affected, like Ubuntu 2025-XX, get more commonly used. Therefore, I propose to backport it there too. The JDK 21 backport got shipped with the 21.0.10 update in January. The patch is not clean due to `nullptr` vs `NULL` differences and more context changes (e.g. [JDK-8261242](https://bugs.openjdk.org/browse/JDK-8261242) not in JDK 17). Since the patch is not clean anyway, I've included the one-liner of [JDK-8354878](https://bugs.openjdk.org/browse/JDK-8354878) right away.
> 
> Testing:
> - [x] GHA
> - [x] Container tests on cg v1 and cg v2 on Linux x86_64 (RHEL 8 and Fedora 42). Manual testing on an affected cg v2 system that container limits are detected.

On my host (Debian, kernel `6.16.9+deb14-amd64`),  with the parent PID (the shell) `memory.max` set to 200MiB.

before:

$ ./build/linux-x64/jdk/bin/java -Xlog:os+container=trace -XshowSettings:system -version
...
[0.000s][debug][os,container] controller memory is not enabled
[0.000s][debug][os,container] One or more required controllers disabled at kernel level.


after:

$ ./build/linux-x64/jdk/bin/java -Xlog:os+container=trace -XshowSettings:system -version
...
[0.004s][trace][os,container] Raw value for memory limit is: 209715200
...
    Memory Limit: 200.00M


i.e., the warning about missing memory controller has gone.

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

PR Comment: https://git.openjdk.org/jdk17u-dev/pull/4271#issuecomment-3950783849


More information about the jdk-updates-dev mailing list