RFR: 8284950: Swappiness disables swap space usage

Ioi Lam iklam at openjdk.java.net
Mon Apr 18 16:28:31 UTC 2022


On Mon, 18 Apr 2022 16:22:27 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> set memory.swappiness to 0,swap space will not be used 
>> determine the value of memory.swappiness
>> https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
>> 
>> 
>>     Memory Limit: 50.00M
>>     Memory Soft Limit: Unlimited
>>     Memory & Swap Limit: 100.00M
>>     Maximum Processes Limit: 4194305 
>> 
>> =>
>> 
>>     Memory Limit: 50.00M
>>     Memory Soft Limit: Unlimited
>>     Memory & Swap Limit: 50.00M
>>     Maximum Processes Limit: 4194305
>
> src/java.base/linux/classes/jdk/internal/platform/cgroupv1/CgroupV1Subsystem.java line 155:
> 
>> 153:         long memswBytes = getLongValue(controller, "memory.memsw.limit_in_bytes");
>> 154:         long swappiness = getLongValue(controller, "memory.swappiness");
>> 155:         return (memswBytes > 0 && swappiness > 0);
> 
> Does this also need to be changed in the test?
> 
> https://github.com/openjdk/jdk/blob/c63fabe3d582ce0828b04b0224cea49aab5fedf3/test/lib/jdk/test/lib/containers/cgroup/MetricsTesterCgroupV1.java#L291-L296

There's also corresponding code in HotSpot:

https://github.com/openjdk/jdk/blob/c63fabe3d582ce0828b04b0224cea49aab5fedf3/src/hotspot/os/linux/cgroupV1Subsystem_linux.cpp#L129-L150

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

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


More information about the core-libs-dev mailing list