8284950: CgroupV1 detection code should consider memory.swappiness

Reviewed-by: sgehwolf, iklam
This commit is contained in:
bobpengxie 2022-05-16 06:40:54 +00:00 committed by Jie Fu
parent e2448cee57
commit 46d208fb1c
4 changed files with 142 additions and 5 deletions

View file

@ -150,8 +150,9 @@ public class CgroupV1Subsystem implements CgroupSubsystem, CgroupV1Metrics {
}
private static boolean getSwapEnabled(CgroupV1MemorySubSystemController controller) {
long retval = getLongValue(controller, "memory.memsw.limit_in_bytes");
return retval > 0;
long memswBytes = getLongValue(controller, "memory.memsw.limit_in_bytes");
long swappiness = getLongValue(controller, "memory.swappiness");
return (memswBytes > 0 && swappiness > 0);
}