[jdk21u-dev] RFR: 8349988: Change cgroup version detection logic to not depend on /proc/cgroups
duke
duke at openjdk.org
Thu Oct 30 19:12:59 UTC 2025
On Fri, 24 Oct 2025 14:55:29 GMT, Sergey Chernyshev <schernyshev at openjdk.org> wrote:
> Hi all,
>
> This is a clean backport of JDK-8349988 to JDK 21. The only minor context conflict is in src/hotspot/share/prims/whitebox.hpp.
>
> The change improves container detection with newer kernels such as 6.14 HWE ([bug](https://bugs.launchpad.net/ubuntu/+source/linux-hwe-6.14/+bug/2122368)).
>
>
> podman run -v $TEST_JDK:/opt/jdk --rm -ti --memory 200m --memory-swap 200m ubuntu:24.04 /opt/jdk/bin/java -XshowSettings:system --version
>
>
>
> --- before 2025-10-24 16:33:52.000000000 +0200
> +++ after 2025-10-24 16:34:19.000000000 +0200
> @@ -1,6 +1,18 @@
> Operating System Metrics:
> Provider: cgroupv2
> - System not containerized.
> + Effective CPU Count: 12
> + CPU Period: 100000us
> + CPU Quota: -1
> + CPU Shares: -1
> + List of Processors: N/A
> + List of Effective Processors: N/A
> + List of Memory Nodes: N/A
> + List of Available Memory Nodes: N/A
> + Memory Limit: 200.00M
> + Memory Soft Limit: 0.00K
> + Memory & Swap Limit: 200.00M
> + Maximum Processes Limit: 2048
> +
> openjdk 21.0.10-internal 2026-01-20
> OpenJDK Runtime Environment (build 21.0.10-internal-adhoc.user.jdk21u)
> OpenJDK 64-Bit Server VM (build 21.0.10-internal-adhoc.user.jdk21u, mixed mode, sharing)
>
>
>
> Tests:
>
> No regressions observed in `test/hotspot/jtreg/containers/`, `test/jdk/jdk/internal/platform`
>
> Details:
>
> <details><summary>kernel 6.14 HWE Cgroup v2</summary>
> <p>
>
>
> --- test_results/summaryHotspotOrigCgv2.txt 2025-10-23 18:52:12.000000000 +0200
> +++ test_results/summaryHotspotUpdatedCgv2.txt 2025-10-23 18:52:12.000000000 +0200
> @@ -2,18 +2,18 @@
> containers/cgroup/TestContainerized.java Passed. Execution successful
> containers/docker/DockerBasicTest.java Passed. Execution successful
> containers/docker/ShareTmpDir.java Passed. Execution successful
> -containers/docker/TestCPUAwareness.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: 'active_processor_count.*1' missing from stdout/stderr
> -containers/docker/TestCPUSets.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: assertTrue: expected true, was false
> -containers/docker/TestContainerInfo.java Passed. Skipped: jtreg.SkippedException: This test is cgroups v2 specific, skipped on cgroups v1
> -containers/docker/TestJFREvents.java Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: 'totalSize = 209715200' missing from stdout/stderr
> +containers/docker/Tes...
@sercher
Your change (at version 0275d345d754ee83bb503064c450841ebac65730) is now ready to be sponsored by a Committer.
-------------
PR Comment: https://git.openjdk.org/jdk21u-dev/pull/2390#issuecomment-3469667615
More information about the jdk-updates-dev
mailing list