RFR: 8334254: Cleanup CGroups initialization code

Johan Sjölen jsjolen at openjdk.org
Fri Jun 14 09:11:19 UTC 2024


On Fri, 14 Jun 2024 08:56:41 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Hi,
>> 
>> Please consider this patch which attempts to improve the code quality of some of the cgroups code, somewhat.
>> 
>> 1. Get rid of `#define`s and upgrade to a `CG_INFO` enum, with some helpers
>> 2. Make some of the code prettier by removing copy-pasted and edited code
>> 3. Make `CgroupInfo` RAII, ridding us of the `cleanup` function
>> 4. `set_subsystem_path` is **only** used at construction time, only call it at that time and make those functions private. Also remove `virtual`ness, as this is unnecessary now.
>> 
>> Testing:
>> 
>> 1. cgroupTest group in gtest.
>> 
>> Thank you.
>
> src/hotspot/os/linux/cgroupSubsystem_linux.cpp line 382:
> 
>> 380:   for (int i = CG_INFO_START; i < CG_INFO_REQUIRED_END; i++) {
>> 381:     if (!cg_infos[i]._data_complete) {
>> 382:       log_debug(os, container)("Required cgroup v1 memory subsystem not found");
> 
> This log message is misleading. We either need to figure out which index we have and map that to `memory`, `cpuacct`, etc. or leave out `memory`.

Good catch, you were kind enough to our future selves to add that function earlier. I'll fix it :).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19709#discussion_r1639521159


More information about the hotspot-runtime-dev mailing list