[RFC] Backport cgroups v2 support to 11u?

Severin Gehwolf sgehwolf at redhat.com
Fri Feb 25 10:14:36 UTC 2022


We, Red Hat, think that getting cgroups v2 support backported to JDK
11u (and perhaps 8u) would be good at this point since systems which
use cgroups v2 by default become more an more widely used. For example
Red Hat Enterprise Linux 9[1] will have that turned on by default.
Recent Fedora and Ubuntu distributions have it on by default.
Similarly, container technology such as Docker and Kubernetes support
cgroups v2 as well.

The risk of NOT backporting those patches is that the JVM would wrongly
detect resource limits. Even though, -XX:+UseContainerSupport is on by
default in 11u, container detection code would just give up early and
would use the host systems' resource limits instead. That gets us back
to pre-JDK-8146115[2] behaviour of the JDK when running on such
systems. I.e. random OOM kills and other strange behaviour. IMHO, that
would be bad.

Cgroups v2 support has been available in the JDK since version 15 and
up and, I believe, most bugs have been shaken out in due course.
Support code has been pretty stable over the last couple of major JDK
releases. The code is Linux-only and is pretty self-contained. It is
our belief that the risks of introducing those patches to 11u is

We propose to backport the following patch-set from JDK 15+:

Cgroups v2: Container awareness

Cgroups v2: Rework Metrics in java.base so as to recognize unified hierarchy

8230305 causes slowdebug build failure

[cgroups v2] Soft memory limit incorrectly using memory.high

Cgroups: Incorrect detection logic on old systems in hotspot

Cgroups: Incorrect detection logic on some systems

jtreg test error in test/hotspot/jtreg/containers/docker/TestMemoryAwareness.java

containers/cgroup/PlainRead.java fails on Ubuntu 21.10

[cgroups v2] Account for the fact that swap accounting is disabled on some systems

Cgroups: Incorrect detection logic on some systems (still reproducible)

[Metrics] Enhance parsing of cgroup interface files for version detection

HotSpot Not Identifying it is Running in a Container

Cgroup: 'stomping of _mount_path' crash if manually mounted cpusets exist

[TESTBUG] Increase coverage of the cgroups detection code

Thoughts? What do other 11u maintainers think?


[1] https://www.redhat.com/en/blog/whats-new-rhel-90-beta
[2] https://bugs.openjdk.java.net/browse/JDK-8146115

More information about the jdk-updates-dev mailing list