RFR: 8253727: [cgroups v2] Memory and swap limits reported incorrectly [v2]
Bob Vandette
bobv at openjdk.java.net
Tue Sep 29 14:43:58 UTC 2020
On Tue, 29 Sep 2020 11:16:56 GMT, Severin Gehwolf <sgehwolf at openjdk.org> wrote:
>> Account for interface files for swap and memory being reported independently.
>> The cgroup v1-like value is now reported by adding the memory.max value to
>> the memory.swap.max value.
>>
>> Testing: Container tests on Linux x86_64 on cgroups v2 with crun 0.15
>
> Severin Gehwolf has updated the pull request incrementally with one additional commit since the last revision:
>
> Account for unlimited values in the test for memory.swap.max/memory.max
> @bobvandette Could you please look at this as well? It would be much appreciated. Thanks!
I made some comments before this most recent change. Did you see them?
src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp line 168:
> 166: char* mem_swp_limit_str = mem_swp_limit_val();
> 167: jlong swap_limit = limit_from_str(mem_swp_limit_str);
> 168: if (swap_limit >= 0) {
In the recent fix for JDK-8250984, we added support for systems that don't have swap accounting enabled. CgroupV2
currently has a bug where you can't even set memory limits in this config but assuming they will fix that, we might
want to add that support for v2 now. If the memory.swap.max file is not avail, then we return whatever memory limit is.
src/hotspot/os/linux/cgroupV2Subsystem_linux.cpp line 170:
> 168: if (swap_limit >= 0) {
> 169: jlong memory_limit = read_memory_limit_in_bytes();
> 170: if (memory_limit == -1) {
Shouldn't this be an assert. If swap limit is set, you need a memory limit set.
src/java.base/linux/classes/jdk/internal/platform/cgroupv2/CgroupV2Subsystem.java line 297:
> 295: return swapLimit;
> 296: }
> 297:
Do you have the same issue with getMemoryAndSwapUsage "memory.swap.current", where you have a to add memory usage +
swap usage? I did a quick test and found that the memory.swap.current file does not appear to include memory usage. I
set a memory and swap limit and memory.current was 3M but memory.swap.current was 0.
If you apply the JDK-8250984 fix for v2, getMemoryAndSwapUsage will have to be fixed as well.
-------------
PR: https://git.openjdk.java.net/jdk/pull/384
More information about the core-libs-dev
mailing list