[LTP] [PATCH] syscalls/mmap22: set also memory.swap.max
Jan Stancek
jstancek@redhat.com
Wed May 14 14:59:04 CEST 2025
In some environments, the system appears to be able to
swap in faster pace than what's needed for allocation
to be DROPPED. So, set limit also for memory.swap.max to
avoid swap usage.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
testcases/kernel/syscalls/mmap/mmap22.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/testcases/kernel/syscalls/mmap/mmap22.c b/testcases/kernel/syscalls/mmap/mmap22.c
index 0e589dfabf45..1507fdfa78c3 100644
--- a/testcases/kernel/syscalls/mmap/mmap22.c
+++ b/testcases/kernel/syscalls/mmap/mmap22.c
@@ -32,6 +32,10 @@ static void test_mmap(void)
cg_child = tst_cg_group_mk(tst_cg, "child");
SAFE_CG_PRINTF(tst_cg, "memory.max", "%d", MEM_LIMIT);
+ if (!TST_CG_VER_IS_V1(tst_cg, "memory"))
+ SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%d", 0);
+ else
+ SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%d", MEM_LIMIT);
SAFE_CG_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
alloc = SAFE_MMAP(0, alloc_size, PROT_READ | PROT_WRITE,
--
2.47.1
More information about the ltp
mailing list