[LTP] [PATCH] process_madvise01: running the test in mem_cg

Li Wang liwang@redhat.com
Fri Jan 3 09:35:28 CET 2025


On Thu, Jan 2, 2025 at 10:59 PM Petr Vorel <pvorel@suse.cz> wrote:

> Hi Li,
>
> > The MADV_PAGEOUT behavior in the kernel is advisory and may skip
> > swapping if the system has sufficient free RAM, even when the
> > advice is explicitly requested. This causes sporadic false positives
> > in our CI, particularly on systems with large amounts of RAM:
>
> >   process_madvise01.c:38: TINFO: Allocate memory: 1048576 bytes
> >   process_madvise01.c:99: TINFO: Reclaim memory using MADV_PAGEOUT
> >   process_madvise01.c:62: TFAIL: Expect: Most of the memory has been
> swapped out: 0kB out of 1024kB
>
> > To address this, the patch confines the test to a memory cgroup
> > with configured limits for memory.max and memory.swap.max, improving
> > control over memory and swap usage. This reduces the likelihood of
> > false positives caused by system-wide memory conditions.
>
> Out of curiosity, on how many RAM does it fail? And is it arch specific?
>
>
Ah, I completely forgot the context of this patch, my memory is bad now :/.


> ...
> > +++ b/testcases/kernel/syscalls/process_madvise/process_madvise01.c
> > @@ -23,7 +23,9 @@
> >  #include "lapi/syscalls.h"
> >  #include "process_madvise.h"
>
> > -#define MEM_CHILD    (1 * TST_MB)
> > +#define MEM_LIMIT   (100 * TST_MB)
> > +#define MEMSW_LIMIT (200 * TST_MB)
> > +#define MEM_CHILD   (1   * TST_MB)
> ...
> > @@ -123,7 +131,9 @@ static struct tst_test test = {
> >       .min_kver = "5.10",
> >       .needs_checkpoints = 1,
> >       .needs_root = 1,
> > -     .min_swap_avail = MEM_CHILD / TST_MB,
> > +     .min_mem_avail = 2 * MEM_LIMIT / TST_MB,
> Requiring 200 MB for test looks LGTM.
>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>

Thanks for the review, after reading the patch summary I guess it
still makes sense to apply it, since MADV_PAGEOUT is indeed not
a mandatory option and still may ignored by kernel in the test.

-- 
Regards,
Li Wang


More information about the ltp mailing list