RFR: 8331560: Refactor Hotspot container detection code so that subsystem delegates to controllers [v3]

Severin Gehwolf sgehwolf at openjdk.org
Fri Jun 14 15:54:36 UTC 2024


On Thu, 13 Jun 2024 15:44:04 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> Reading this code a bit more, seems like `CgroupController` just exposes a virtual function `subsystem_path`. But this function is only ever called from within `CgroupController`, and we never seem to want to handle a Cgroup controller in a generic way anyway. We can just make the subsystem_path be an argument to all of the functions which require it in `CgroupController` and make that class `AllStatic` and have no one inherit from it.
>> 
>> I also find the general usage of `malloc` concerning. looking at the class `CgroupV1Controller`, this doesn't have a corresponding destructor even though it seems like it owns the memory which it has pointers to. This can just hold the memory directly, no pointers necessary.
>
> Basically a `CgroupController`'s job is to read from the interface file. In order to do so it needs a base path to the interface files, which is determined elsewhere.
> 
> I'll rework the patch to get rid of the multiple-inheritance.

TBH, I found the multiple inheritance a bit cleaner. FWIW, the "is-a" relationship held previously. Anyway it's changed now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19085#discussion_r1640018074


More information about the hotspot-runtime-dev mailing list