[LTP] [PATCH] syscalls/mmap22: set also memory.swap.max
Li Wang
liwan@redhat.com
Wed May 14 15:08:03 CEST 2025
On Wed, May 14, 2025 at 8:58 PM Jan Stancek <jstancek@redhat.com> wrote:
>
> 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>
Acked-by: Li Wang <liwang@redhat.com>
And I vote to merge this one before the LTP May release.
> ---
> 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