RFR: 8253727: [cgroups v2] Memory and swap limits reported incorrectly [v2]

Severin Gehwolf sgehwolf at openjdk.java.net
Tue Sep 29 15:07:32 UTC 2020


On Mon, 28 Sep 2020 18:01:28 GMT, Bob Vandette <bobv at openjdk.org> wrote:

>> 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
>
> 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.

Hmm, I'd prefer if we kept those two changes separate. This makes it easier to backport and makes intent more obvious.
FWIW, I'd like to bring this to 15u. I've filed https://bugs.openjdk.java.net/browse/JDK-8253797 to track this.

> 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.

OK, fine with me. I'll fix it.

> Do you have the same issue with getMemoryAndSwapUsage "memory.swap.current", where you have a to add memory usage +
> swap usage?

That's a good point. I'll fix that as well.

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

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


More information about the core-libs-dev mailing list