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

Thomas Fitzsimmons duke at openjdk.org
Tue Apr 1 16:04:26 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.

OK; @ashu-mehra do you want me to try the function pointer approach?  I agree with @jerboaa that it will result in more complex code.  Practically speaking I would rather keep the `statfs` call in `CgroupSubsystemFactory::create` even though I agree it is logically part of determining the `cgroup` type.

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

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


More information about the hotspot-dev mailing list