RFR: 8230848: OSContainer: Refactor container detection code

Bob Vandette bob.vandette at oracle.com
Tue Oct 1 14:43:14 UTC 2019


I’d prefer if you just added cgroupv2 support with these types of changes all at the same time.
Having to look at two patches is just more work for nothing.

In terms of your factoring approach, I don’t see why you need to move so much logic out of os_linux.cpp.

The OSContainer interface should be used independent of which cgroup implementation is active.

os_linux should use the existing OSContainer interface.

OSContainer_linux should include the logic which selects cgroupv1 versus cgroupv2 and
calls through a common cgroupSubsystem_linux class.  This cgroupSubsystem_linux class
should provide common functions that both v1 and v2 use. 

I’d then expect to see cgroupV1Subsystem_linux.?pp and cgroupV2Subsystem_linux.?pp files which 
extends cgroupSubsystem and contain version specific functions.


> On Sep 19, 2019, at 10:20 AM, Severin Gehwolf <sgehwolf at redhat.com> wrote:
> Hi,
> Please review this code refactoring which will help getting a cgroups
> v2 implementation for OSContainer implemented. The proposed changes are
> mentioned in the bug. In essence, after this patch only methods
> actually called in os_linux.cpp are exposed via OSContainer. Everything
> else remains an implementation detail. After this refactoring it should
> also be clearer what the actual bits implemented via cgroups v1 are in
> hotspot. Functionally there should be no difference before and after
> this patch.
> If you are curious where I'm going with this, have a look at JDK-
> 8230305 which has a draft of an implementation of cgroups v2 building
> on top of this patch.
> Bug: https://bugs.openjdk.java.net/browse/JDK-8230848
> webrev: http://cr.openjdk.java.net/~sgehwolf/webrevs/JDK-8230848/03/webrev/
> Testing: jdk-submit, tier1 tests on Linux x86_64, container tests
>         with docker and podman.
> Thoughts?
> Thanks,
> Severin

More information about the hotspot-dev mailing list