[LTP] [PATCH v4] mmap22.c: Test for new MAP_DROPPABLE flag for mmap
Jan Stancek
jstancek@redhat.com
Wed May 14 13:15:09 CEST 2025
On Wed, May 14, 2025 at 11:14 AM Li Wang <liwang@redhat.com> wrote:
>
> On Wed, May 14, 2025 at 5:10 PM Jan Stancek <jstancek@redhat.com> wrote:
> >
> > On Wed, May 14, 2025 at 11:04 AM Li Wang <liwang@redhat.com> wrote:
> > >
> > > On Wed, May 14, 2025 at 4:52 PM Jan Stancek via ltp <ltp@lists.linux.it> wrote:
> > > >
> > > > On Tue, May 13, 2025 at 5:44 AM Wei Gao <wegao@suse.com> wrote:
> > > > >
> > > > > On Mon, May 12, 2025 at 10:43:55AM +0200, Jan Stancek wrote:
> > > > > > Is anyone else seeing this test failing on recent 6.15-rc5 kernels?
> > > > > >
> > > > > > ==== mmap22 ====
> > > > > > command: mmap22
> > > > > > tst_tmpdir.c:316: TINFO: Using /tmp/LTP_mmazCULNN as tmpdir (tmpfs filesystem)
> > > > > > tst_test.c:1938: TINFO: LTP version: 20250130-253-g4a0e3a8fa
> > > > > > tst_test.c:1942: TINFO: Tested kernel:
> > > > > > 6.15.0-0.rc5.250509g9c69f8884904.47.eln148.x86_64 #1 SMP
> > > > > > PREEMPT_DYNAMIC Fri May 9 15:17:31 UTC 2025 x86_64
> > > > > > tst_kconfig.c:88: TINFO: Parsing kernel config
> > > > > > '/lib/modules/6.15.0-0.rc5.250509g9c69f8884904.47.eln148.x86_64/build/.config'
> > > > > > tst_test.c:1758: TINFO: Overall timeout per run is 0h 05m 54s
> > > > > > mmap22.c:55: TFAIL: MAP_DROPPABLE did not drop memory within the timeout period.
> > > > > >
> > > > >
> > > > > I have tested rc5/6 and both give pass result.
> > > >
> > > > I do see it fail almost daily on multiple arches (VMs and baremetal),
> > > > maybe some difference in our config.
> > >
> > > Have you tried the original self-test (without using Cgroup)?
> > > If it still fails, consider it a kernel issue.
> >
> > I'll have a closer look and try manually. At first glance at test, I
> > suspect compiler
> > doing something clever for:
> > for (;;)
> > *(char *)malloc(page_size) = 'B';
>
> Probably, -O2 is the default in LTP compiling.
>
> Or, you could also try disabling KSM when testing mmap22.c to see if it helps.
In case of my VM, it looks like it's able to swap faster than what's
needed to drop the allocation.
With this I get PASS right away:
diff --git a/testcases/kernel/syscalls/mmap/mmap22.c
b/testcases/kernel/syscalls/mmap/mmap22.c
index 0e589dfab..56fe412d1 100644
--- a/testcases/kernel/syscalls/mmap/mmap22.c
+++ b/testcases/kernel/syscalls/mmap/mmap22.c
@@ -32,6 +32,7 @@ static void test_mmap(void)
cg_child = tst_cg_group_mk(tst_cg, "child");
SAFE_CG_PRINTF(tst_cg, "memory.max", "%d", MEM_LIMIT);
+ SAFE_CG_PRINTF(tst_cg, "memory.swap.max", "%d", 1);
SAFE_CG_PRINTF(cg_child, "cgroup.procs", "%d", getpid());
alloc = SAFE_MMAP(0, alloc_size, PROT_READ | PROT_WRITE,
More information about the ltp
mailing list