RFR: 8349988: Change cgroup version detection logic to not depend on /proc/cgroups

Severin Gehwolf sgehwolf at openjdk.org
Wed Mar 5 15:51:54 UTC 2025


On Thu, 27 Feb 2025 15:11:31 GMT, Thomas Fitzsimmons <duke at openjdk.org> wrote:

>> This pull request fixes https://bugs.openjdk.org/browse/JDK-8349988 and https://bugs.openjdk.org/browse/JDK-8347811.
>> 
>> I tested it with:
>> 
>> 
>> java -Xlog:os+container=trace -version
>> 
>> on:
>> 
>> `Red Hat Enterprise Linux 8 (cgroups v1 only)`:
>> _No change in behaviour_
>> 
>> `Fedora 41 (cgroups v2)`:
>> _More verbose output due to `/sys/fs/cgroup/cgroup.controllers` parsing:_
>> 
>> --- tt-old-f41.txt	2025-02-26 15:37:56.310738515 -0500
>> +++ tt-new-f41.txt	2025-02-26 15:37:56.601739407 -0500
>> @@ -1,7 +1,12 @@
>>  [trace][os,container] OSContainer::init: Initializing Container Support
>> -[debug][os,container] Detected optional pids controller entry in /proc/cgroups
>> -[debug][os,container] controller cpuset is not enabled
>> -                    ] 
>> +[debug][os,container] v2 controller cpuset is enabled and relevant
>> +[debug][os,container] v2 controller cpu is enabled and required
>> +[debug][os,container] v2 controller io is enabled but not relevant
>> +[debug][os,container] v2 controller memory is enabled and required
>> +[debug][os,container] v2 controller hugetlb is enabled but not relevant
>> +[debug][os,container] v2 controller pids is enabled and relevant
>> +[debug][os,container] v2 controller rdma is enabled but not relevant
>> +[debug][os,container] v2 controller misc is enabled but not relevant
>>  [debug][os,container] Detected cgroups v2 unified hierarchy
>>  [trace][os,container] Adjusting controller path for memory: /sys/fs/cgroup/user.slice/user-4215196.slice/user at 4215196.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-135086d6-2de4-4f2e-ad94-899b5eecaf83.scope
>>  [trace][os,container] Path to /memory.max is /sys/fs/cgroup/user.slice/user-4215196.slice/user at 4215196.service/app.slice/app-org.gnome.Terminal.slice/vte-spawn-135086d6-2de4-4f2e-ad94-899b5eecaf83.scope/memory.max
>> 
>> 
>> `Fedora 41 (custom kernel with cgroups v1 disabled)`:
>> _Fixes `cgroups v2` detection:_
>> 
>> --- tt-old-f41-custom-kernel.txt	2025-02-26 15:37:58.197744304 -0500
>> +++ tt-new-f41-custom-kernel.txt	2025-02-26 15:37:59.380747933 -0500
>> @@ -1,7 +1,63 @@
>>  [trace][os,container] OSContainer::init: Initializing Container Support
>> -[debug][os,container] Detected optional pids controller entry in /proc/cgroups
>> -[debug][os,container] controller cpuset is not enabled
>> -                    ] 
>> -[debug][os,container] controller memory is not enabled
>> -                    ] 
>> -[debug][os,container] One or more required controllers disabled at kernel level.
>> +[...
>
> I fixed an existing assert message typo that I noticed while working on the patch, `hierarchy mismatch for cpuacc[t]`.  Strictly speaking it is not related to either bug report, but I figured it did not warrant a bug report of its own.

@fitzsim Could you please merge latest master? https://bugs.openjdk.org/browse/JDK-8343191 got merged since. Thanks!

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

PR Comment: https://git.openjdk.org/jdk/pull/23811#issuecomment-2701346527


More information about the hotspot-dev mailing list