RFR: 8302744: Refactor Hotspot container detection code

Severin Gehwolf sgehwolf at openjdk.org
Tue May 7 09:49:51 UTC 2024


On Mon, 6 May 2024 09:45:48 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> Please review this container detection code refactoring in hotspot. The main point of this is to
>> 
>> - get rid of the `GET_CONTAINER_INFO` macros which hide too many things under the hood
>> - prevent refactoring of the code (since `GET_CONTAINER_INFO` macros short-return and are therefore not portable; at least not without some risk)
>> - make the code easier to understand
>> - allow for better testing via `gtest`
>> - separate multi-line parsing from single line parsing for clarity.
>> 
>> Testing:
>> - [x] GHA
>> - [x] `gtest:cgroupTest` tests
>> - [x] Container tests on Linux with cgroup v1 (legacy) and cgroup v2. All pass.
>> 
>> Thoughts?
>
> src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp line 84:
> 
>> 82:     return (jlong)OSCONTAINER_ERROR;
>> 83:   }
>> 84:   log_trace(os, container)("Use Hierarchy is: " JLONG_FORMAT, use_hierarchy);
> 
> A future RFE should change these to taking an out parameter and returning the int directly, no casting involved. Also, generally strange that we log the same thing regardless if it's an error or not.

The idea would be for this use_hierarchy parsing to go away after https://bugs.openjdk.org/browse/JDK-8322420

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19060#discussion_r1592141566


More information about the hotspot-runtime-dev mailing list