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

Thomas Fitzsimmons duke at openjdk.org
Mon Mar 3 19:24:04 UTC 2025


On Fri, 28 Feb 2025 12:46:48 GMT, Thomas Fitzsimmons <duke at openjdk.org> wrote:

>> Update: Please remove the log line, since this is the cg v1 branch and there cpuset isn't optional.
>
> OK, will do.  This represents a change to debug logging on `RHEL-8`, at least in my default test configuration.  Currently it is, with and without my patch:
> 
> 
> $ jdk/bin/java -Xlog:os+container=trace -version
> [0.001s][trace][os,container] OSContainer::init: Initializing Container Support
> [0.001s][debug][os,container] Detected optional cpuset controller entry in /proc/cgroups
> [0.001s][debug][os,container] Detected optional pids controller entry in /proc/cgroups
> [0.001s][debug][os,container] Detected cgroups hybrid or legacy hierarchy, using cgroups v1 controllers
> [...]
> 
> However, I agree that the change is a good one, since the debug message was inaccurate when the system was ultimately determined to be in `cgroups v1` mode.

Done.

I also added similar log messages to the cg v2 branch for pids and cpuset.  This corrects debug logging on `Fedora 41`:


--- tt-old-f41.txt	2025-03-03 09:27:02.606397900 -0500
+++ tt-new-f41.txt	2025-03-03 09:27:03.287401780 -0500
@@ -1,7 +1,6 @@
 [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] Detected optional cpuset controller entry in /sys/fs/cgroup/cgroup.controllers
+[debug][os,container] Detected optional pids controller entry in /sys/fs/cgroup/cgroup.controllers
 [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

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23811#discussion_r1978056483


More information about the hotspot-dev mailing list