From: Wei Gao via ltp <ltp@lists.linux.it>
To: Li Wang <liwang@redhat.com>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v1] mmap21.c: Test for new MAP_DROPPABLE flag for mmap
Date: Fri, 3 Jan 2025 08:54:29 -0500 [thread overview]
Message-ID: <Z3fsFaLpv+a4irX8@wegao1> (raw)
In-Reply-To: <CAEemH2cdZ1fJHma3xDF1r-wPycbLqXRXT0Q4smqivuAZcWC9GQ@mail.gmail.com>
On Tue, Dec 31, 2024 at 06:04:54PM +0800, Li Wang wrote:
> On Sat, Dec 28, 2024 at 9:32 PM Wei Gao via ltp <ltp@lists.linux.it> wrote:
>
> > +
> > + int *shared_var = SAFE_MMAP(NULL, sizeof(int), PROT_READ |
> > PROT_WRITE,
> > + MAP_SHARED | MAP_ANONYMOUS, -1, 0);
> > +
> > + *shared_var = 0;
> > +
> > + child = SAFE_FORK();
> > + if (!child) {
> > + for (;;) {
> > + *(char *)malloc(page_size) = 'B';
> > + if ((*shared_var) == 1)
> > + exit(0);
> >
>
> If the parent process crashes, hangs, or fails to detect reclaimed
> pages, the child process will run indefinitely, potentially consuming
> system resources.
>
> If it runs too long, add a timeout mechanism to terminate the child process.
After limit the test to an CGroup and set the memory.max = 256M(base your suggestion),
i suppose we do not need this timeout mechanism, since after i test in my env, when
the child run for ~3s, the system will trigger oom_memcg and kill the child.
What's your opinion?
>
> This max_runtime is useless if we run the test on a large RAM system
> which likely takes too long to simulate the memory pressure.
>
> We could limit the test to an CGroup and set the memory.max
> to 256MB, which can complete the mem hog quickly to finish.
>
>
>
> > +};
> > --
> > 2.35.3
> >
> >
> > --
> > Mailing list info: https://lists.linux.it/listinfo/ltp
> >
> >
>
> --
> Regards,
> Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-01-03 13:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-28 13:32 [LTP] [PATCH v1] mmap21.c: Test for new MAP_DROPPABLE flag for mmap Wei Gao via ltp
2024-12-31 10:04 ` Li Wang
2025-01-02 9:38 ` Cyril Hrubis
2025-01-03 1:42 ` Wei Gao via ltp
2025-01-03 13:54 ` Wei Gao via ltp [this message]
2025-01-03 13:56 ` [LTP] [PATCH v2] " Wei Gao via ltp
2025-03-10 16:18 ` Cyril Hrubis
2025-04-16 19:16 ` [LTP] [PATCH v3] mmap22.c: " Wei Gao via ltp
2025-04-25 11:40 ` Cyril Hrubis
2025-04-28 16:04 ` [LTP] [PATCH v4] " Wei Gao via ltp
2025-05-07 15:25 ` Cyril Hrubis
2025-05-12 8:43 ` Jan Stancek via ltp
2025-05-13 15:44 ` Wei Gao via ltp
2025-05-14 8:51 ` Jan Stancek via ltp
2025-05-14 9:04 ` Li Wang via ltp
2025-05-14 9:10 ` Jan Stancek via ltp
2025-05-14 9:14 ` Li Wang via ltp
2025-05-14 11:15 ` Jan Stancek via ltp
2025-05-14 12:44 ` Li Wang via ltp
2025-05-14 12:54 ` Jan Stancek 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=Z3fsFaLpv+a4irX8@wegao1 \
--to=ltp@lists.linux.it \
--cc=liwang@redhat.com \
--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