From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] mem/lib: keep allocating memory until get an error in single process
Date: Mon, 20 Jun 2016 09:03:51 -0400 (EDT) [thread overview]
Message-ID: <214135224.352328.1466427831586.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <20160620113454.GA21624@gmail.com>
----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: "Jan Stancek" <jstancek@redhat.com>
> Cc: ltp@lists.linux.it
> Sent: Monday, 20 June, 2016 1:34:54 PM
> Subject: Re: [PATCH] mem/lib: keep allocating memory until get an error in single process
>
> On Mon, Jun 20, 2016 at 06:43:18AM -0400, Jan Stancek wrote:
> >
> >
> > ----- Original Message -----
> > > From: "Li Wang" <liwang@redhat.com>
> > > To: jstancek@redhat.com
> > > Cc: ltp@lists.linux.it
> > > Sent: Monday, 20 June, 2016 11:53:05 AM
> > > Subject: [PATCH] mem/lib: keep allocating memory until get an error in
> > > single process
> > >
> > > We occasionally catch errors like:
> > > oom03 0 TINFO : start OOM testing for KSM pages.
> > > oom03 0 TINFO : expected victim is 3490.
> > > oom03 6 TFAIL : mem.c:163: victim unexpectedly ended with
> > > retcode:
> > > 0, expected: 12
> > > oom03 0 TINFO : set overcommit_memory to 0
> > >
> > > It cames from the caller testoom(0, 1, ENOMEM, 1). The full reason is
> > > that
> > > function child_alloc() go into single process mode, then successfully
> > > finish
> > > the memory allocation and return 0.
> >
> > Description above doesn't explain why you get 0, when oom03 is set to run
> > in cgroup with memory.memsw.limit_in_bytes == TESTMEM, and then allocates
> > TESTMEM + MB.
> >
> > My guess is a KSM scan merged some pages before you have hit the limit.
> That might be.
>
> > Do yo get these failures always during KSM test?
> No, I just get the failures only once during my test.
>
> > >
> > > In this patch, let's make it (in single mode) keep allocating memory with
> > > an incresed length in order to avoid 0 returned.
>
> Hmm, now I think these codes have two problems.
>
> 1. As you said the KSM merge same pages and let the oom03 failed as above.
>
>
> 2. The child_alloc() probably should also do memory allocation with an
> infinite loop
At the time 'lite' was introduced, everything was single threaded,
the only difference was that lite == 0 would keep allocating in
infinite loop.
Your patch is effectively eliminating lite == 1, which means that
oom03 will pass even if cgroup limits are broken.
> in single process mode. Because if someone has a caller testoom(0, 1, ENOMEM,
> 1) at other
> place in future, that'll be easily get fauilures.
Likely because author is expecting behaviour other than what
we have now:
* @lite: if non-zero, child makes only single TESTMEM+MB allocation
* if zero, child keeps allocating memory until it gets killed
* or some operation fails
> Or, can we solve them in one method?
We could skip oom(KSM) if lite == 1 in testoom(), since limit_in_bytes
may vary from run to run, which isn't reliable for oom03 cgroup test.
Or we could change alloc_mem for lite == 1 && testcase == KSM,
such that each page would have unique content (to prevent merging).
Regards,
Jan
next prev parent reply other threads:[~2016-06-20 13:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 9:53 [LTP] [PATCH] mem/lib: keep allocating memory until get an error in single process Li Wang
2016-06-20 10:43 ` Jan Stancek
2016-06-20 11:34 ` Li Wang
2016-06-20 13:03 ` Jan Stancek [this message]
2016-06-21 3:26 ` Li Wang
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=214135224.352328.1466427831586.JavaMail.zimbra@redhat.com \
--to=jstancek@redhat.com \
--cc=ltp@lists.linux.it \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.