[jdk25u-dev] RFR: 8370572: Cgroups hierarchical memory limit is not honored after JDK-8322420
Aleksey Shipilev
shade at openjdk.org
Mon Dec 15 10:28:48 UTC 2025
On Thu, 11 Dec 2025 11:38:27 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
> Unclean backport of JDK-8370572 since JDK-8292984 is not in 25u (a cleanup patch). That change basically renames `phys_mem` to `upper_bound`. Not really critical to get JDK-8292984 into 25u. What's more, the changes in this patch have the changes done in JDK tip with JDK-8365606 of moving the `if (uses_hierarchy)` inside the branch where the limit is larger than the host limit (upper bound limit). This is the more defensive fix to not fall into the `else` branch should `memory.use_hierarchy` see a `0`.
>
> Please review!
>
> Testing:
> - [x] GHA
> - [x] Container tests on Linux x86_64 on cgroups v1 including the test from JDK-8370966 ([see dependent PR](https://github.com/openjdk/jdk25u-dev/pull/77)). Also checked container tests on cgroups v2 for sanity. This patch is a no-op there.
Thanks for doing this! I do have a comment:
src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 169:
> 167: CONTAINER_READ_NUMBER_CHECKED(reader(), "/memory.limit_in_bytes", "Memory Limit", memlimit);
> 168: if (memlimit >= phys_mem) {
> 169: if (uses_mem_hierarchy()) {
I understand you want a more defensive fix. But I don't think we want to diverge from mainline, really: this just creates another code shape that would be a headache for future maintenance and backports. Unless I don't see a hidden problem somewhere here?
FWIW, we picked up the mainline version in Corretto 25 and it works fine:
https://github.com/corretto/corretto-25/commit/d38805b294493ad7a7e582286d64a874121417f8
-------------
Changes requested by shade (Reviewer).
PR Review: https://git.openjdk.org/jdk25u-dev/pull/76#pullrequestreview-3577451600
PR Review Comment: https://git.openjdk.org/jdk25u-dev/pull/76#discussion_r2618829274
More information about the jdk-updates-dev
mailing list