RFR: 8231111: Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy
sgehwolf at redhat.com
Fri Nov 15 16:51:31 UTC 2019
Could I please get reviews of these core-libs, Linux-only, changes to
the Metrics subsystem? This patch implements cgroupv2 support for
Metrics which are currently cgroupv1-only. Fedora 31 switched to
cgroupv2 by default so it's time to get OpenJDK recognize it.
Note that a couple of metrics are no longer supported with cgroupv2.
Most notably (not an exhaustive list, though):
Metrics.getKernel*() family of methods.
Metrics.getTcp*() family of methods.
Metrics.getBlkIO*() family of methods.
A couple of open questions with regards to that:
Most API docs of Metrics make no distiction between "unlimited" and
"not supported", both returning -1 for longs, for example. This is a
problem, because output of "java -XshowSettings:system -version" will
not distinguish between unlimited and not supported metrics. Would it
be acceptable to change the API to distinguish those cases so that
LauncherHelper could display them appropriately?
How should we deal with "not supported" for booleans/arrays, etc.?
Would it make sense to return record objects from the Metrics API so
that this could be dealt with? E.g.
Metrics m = ...
MetricResult<int> result = m.getCpuSetCpus();
case NOT_SUPPORTED: /* do something */; break;
case SUPPORTED: int val = result.get(); break;
I'm bringing this up, because the proposed patch doesn't deal with the
above open questions as of yet. With that being said, it's mostly
identical to the proposed hotspot changes in .
Testing: jdk/submit and platform docker tests on Linux x86_64 (with
hybrid hierarchy, docker/podman) and on Linux x86_64 with unified
hierarchy (podman only).
More information about the core-libs-dev