[LTP] [PATCH v1] mmapstress06: Rate limit page-dirtying loop to prevent MemCG OOM-kills
Andrea Cervesato
andrea.cervesato@suse.com
Tue Sep 1 09:38:01 CEST 2026
Hi Wei,
> > Something as:
> >
> > diff --git a/testcases/kernel/mem/mmapstress/mmapstress06.c b/testcases/kernel/mem/mmapstress/mmapstress06.c
> > index 4e6023399..2c0c6fb02 100644
> > --- a/testcases/kernel/mem/mmapstress/mmapstress06.c
> > +++ b/testcases/kernel/mem/mmapstress/mmapstress06.c
> > @@ -59,8 +59,9 @@ static void run_test(void)
> >
> > for (size_t i = 0; i < map_size; i += page_size) {
> > mmapaddr[i] = 'a';
> > - if ((i % (2 * 1024 * 1024)) == 0)
> > - usleep(1000);
> > +
> > + if (i >= mem_limit && !(i % (2 * 1024 * 1024)))
> > + usleep(100000);
> > }
> >
> > The testrun increses to 6s from 1s but it makes the OOM very unlikely to
> > happen.
> Thanks for your suggestion.
> I have tested above solution in our openqa setup but still encounter failure, 3 test cases
> still failure with oom after run 100 cases. Maybe slow down dirty loop
> is still too late?
I still believe there's no way to avoid this, unless we re-implement the
OOM-killer or memory.reclaim mechanism increasing the amount of attempts
per request. We will always encounter hardware that is too slow that
won't swap memory fast enough for the test.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
More information about the ltp
mailing list