RFR: 8284950: CgroupV1 detection code should consider memory.swappiness [v6]

Severin Gehwolf sgehwolf at openjdk.java.net
Wed Apr 27 14:38:43 UTC 2022


On Wed, 27 Apr 2022 14:24:50 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:

>> xpbob has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   revert file
>
> test/hotspot/jtreg/containers/docker/TestMisc.java line 60:
> 
>> 58:             testPrintContainerInfo();
>> 59:             testPrintContainerInfoActiveProcessorCount();
>> 60:             testPrintContainerMemoryInfo("100M", "150M");
> 
> Again. This test runs unconditionally. `--memory-swappiness` is not supported in cgroups v2. Thus, the test will fail on a cgroups v2 system. You need to only run this test on a cgroups v1 system. Have a look at `test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java` how could could detect this and only run on `cgroupv1` providers.

On my cgroups v2 system (i.e. it's using 200m memory + 200m swap):

$ sudo docker run --rm -ti --memory-swappiness=0 --memory=200m fedora:35
WARNING: Your kernel does not support memory swappiness capabilities or the cgroup is not mounted. Memory swappiness discarded.
[root at fb3182c8e23c /]# cat /sys/fs/cgroup/memory.max 
209715200
[root at fb3182c8e23c /]# cat /sys/fs/cgroup/memory.swap.max 
209715200

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

PR: https://git.openjdk.java.net/jdk/pull/8285


More information about the core-libs-dev mailing list