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

Severin Gehwolf sgehwolf at openjdk.org
Tue Apr 1 08:45:15 UTC 2025


On Tue, 1 Apr 2025 04:38:00 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:

>> OK, I tend to agree; I will investigate alternatives.  I did consider putting the `statfs` logic inside but ended up leaving it outside because `determine_type` is called by the `whitebox` framework, and "mocking" `statfs` is not possible with regular files.  The idea is to allow the test suite to simply mock the `statfs` result via the boolean `cgroups_v2_enabled` argument.
>
> One option is to pass an argument to `determine_type` to indicate it is being called from the test suite and skip the call to `statfs` in such case.

If we really must, I'd rather have a function pointer for the statfs call which we can replace in test code. It doesn't seem worth the extra complexity in my opinion though.

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

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


More information about the hotspot-dev mailing list