Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Wei Gao <wegao@suse.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] mmapstress06: Rate limit page-dirtying loop to prevent MemCG OOM-kills
Date: Tue, 1 Sep 2026 10:47:47 +0200	[thread overview]
Message-ID: <apaRM2eYb2NbUs5O@yuki.lan> (raw)
In-Reply-To: <apYysdNBmxPxyn3z@autotest-wegao.qe.prg2.suse.org>

Hi!
> > 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?

AFAIK the swapping does not start until we are over the limit, so
slowing it down before we reach the limit is not going to change
anything. For v2 cgroup we can also set a soft limit memory.high to
slightly smaller number than memory.max, whith that the kernel would
start the swapping once memory.high was reached.

Something as:

if (!TST_CG_VER_IS_V1(cg_child, memory))
        SAFE_CG_PRINT(cg_child, "memory.high", "%lu", mem_limit - mem_limit/8);

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2026-09-01  8:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  2:13 [LTP] [PATCH v1] mmapstress06: Rate limit page-dirtying loop to prevent MemCG OOM-kills Wei Gao via ltp
2026-08-25  3:00 ` [LTP] " linuxtestproject.agent
2026-08-25 12:16 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
2026-08-26  7:13   ` Wei Gao via ltp
2026-08-26  7:58     ` Andrea Cervesato via ltp
2026-08-26  9:31       ` Wei Gao via ltp
2026-08-26  9:49         ` Andrea Cervesato via ltp
2026-08-26 13:38           ` Wei Gao via ltp
2026-08-27  8:06             ` Andrea Cervesato via ltp
2026-08-27 14:21               ` Cyril Hrubis
2026-09-01  2:04                 ` Wei Gao via ltp
2026-09-01  7:38                   ` Andrea Cervesato via ltp
2026-09-01  8:22                     ` Wei Gao via ltp
2026-09-01  8:47                   ` Cyril Hrubis [this message]
2026-09-02  2:57 ` [LTP] [PATCH v2] mmapstress06: Use memory.high in cgroup v2 to start swapping early Wei Gao via ltp
2026-09-02  8:28   ` [LTP] " linuxtestproject.agent
2026-09-04  8:53   ` [LTP] [PATCH v2] " Andrea Cervesato via ltp
2026-09-04 10:23   ` Cyril Hrubis
2026-09-04 10:43   ` Andrea Cervesato via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=apaRM2eYb2NbUs5O@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=wegao@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox