RFR: 8284950: Swappiness disables swap space usage
Ioi Lam
iklam at openjdk.java.net
Wed Apr 20 06:32:30 UTC 2022
On Mon, 18 Apr 2022 09:07:31 GMT, xpbob <duke at openjdk.java.net> 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
Both the PR and the bug report are not clear about exactly what the problem is.
Could you provide a test case that demonstrates the relationship between `memory.memsw.limit_in_bytes` and `memory.swappiness`? It will be best if you can upload a shell script into the bug report so we know the exact steps to reproduce the problem.
Ultimately we should add a new jtreg test case.
# scenario 1
memory.memsw.limit_in_bytes = 1000M
memory.limit_in_bytes = 50M
memory.swappiness = 1
-> "java -Xms60m -XX:+AlwaysPreTouch -version" can successfully complete
# scenario 2
memory.memsw.limit_in_bytes = 1000M
memory.limit_in_bytes = 50M
memory.swappiness = 0
-> "java -Xms60m -XX:+AlwaysPreTouch -version" will be killed by cgroups
Related to your other PR (https://github.com/openjdk/jdk/pull/8256), I think `CgroupV1Subsystem::memory_and_swap_limit_in_bytes()` also need to be changed so that it will return 50M in scenario 2.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8285
More information about the core-libs-dev
mailing list