public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Jan Stancek <jstancek@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH RFC 1/3] min_free_kbytes: Fix child exit status check conditions
Date: Wed, 20 Mar 2019 04:10:04 -0400 (EDT)	[thread overview]
Message-ID: <1928792373.10466963.1553069404279.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <CAEemH2eiWMPL3WsH4fanrbY0mx6n=Apurbp2sNPVfi+UMTw68Q@mail.gmail.com>



----- Original Message -----
> @Vipin, is there any possible you can have a look Jan's question?
> 
> On Wed, Mar 20, 2019 at 12:30 AM Jan Stancek <jstancek@redhat.com> wrote:
> 
> >
> >
> > ----- Original Message -----
> > > From: Vipin K Parashar <vipin@linux.vnet.ibm.com>
> > >
> > > Fixes: #349
> > >
> > > min_free_kbytes test has badly formed if conditions in mem_tune()
> > > for child exit status check.
> >
> > Can you please elaborate what's wrong about it?
> >
> 
> I‘m not sure if Vipin could help to explain this. I just nocited that this
> pull request was pending there more than half year, so I re-send this patch
> to ML for more discussion.
> https://github.com/linux-test-project/ltp/pull/350
> 
> 
> > > This is causing test to declare as FAILED
> > > despite that not being the case.
> >
> > Why? Shouldn't mmap succeed with overcommit == 1?
> >
> 
> I was unable to reproduce this. But AFAIK, 'overcommit == 1' cann't
> guarantee the MAP_FAILED(with ENOMEM) before oom.

With 'overcommit == 1' test always expects OOM. Test output below
suggests that child ended normally, because mmap failed.

> So I roughly made change
> in the original patch to catch up both oom and map_failed scenario for any
> 'overcommit'.
> 
> Beside that, as I was pointed out in patch 3/3, this test has an obviously
> defect in design, I'm also not sure if MemFree + (1/10 *min_free_kbytes) is
> safty enough, but that's only what I can do for the case remedy.
> 
> 
> > > Fix child exit status check conditions.
> > >
> > > ---ERROR LOG---
> > > <..snip..>
> > > mem.c:839: INFO: set overcommit_memory to 1
> > > mem.c:839: INFO: set min_free_kbytes to 11580
> > > memfree is 6974720 kB before eatup mem
> > > memfree is 15488 kB after eatup mem
> > > min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0
> > > mem.c:839: INFO: set min_free_kbytes to 23160
> > > memfree is 7104128 kB before eatup mem
> > > memfree is 26560 kB after eatup mem
> > > min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0
> > > mem.c:839: INFO: set min_free_kbytes to 145812
> > > memfree is 7101504 kB before eatup mem
> > > memfree is 215872 kB after eatup mem
> > > min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0
> > > min_free_kbytes.c:81: PASS: min_free_kbytes test pass
> > > mem.c:839: INFO: set min_free_kbytes to 11580
> > > ---------------
> > >
> > > Signed-off-by: Vipin K Parashar <vipin@linux.vnet.ibm.com>
> > > Signed-off-by: Li Wang <liwang@redhat.com>
> > > Cc: Jan Stancek <jstancek@redhat.com>
> > > ---
> > >  .../kernel/mem/tunable/min_free_kbytes.c      | 40 +++++--------------
> > >  1 file changed, 11 insertions(+), 29 deletions(-)
> > >
> > > diff --git a/testcases/kernel/mem/tunable/min_free_kbytes.c
> > > b/testcases/kernel/mem/tunable/min_free_kbytes.c
> > > index f114dc493..d2378a700 100644
> > > --- a/testcases/kernel/mem/tunable/min_free_kbytes.c
> > > +++ b/testcases/kernel/mem/tunable/min_free_kbytes.c
> > > @@ -119,39 +119,21 @@ static void test_tune(unsigned long
> > overcommit_policy)
> > >
> > >               SAFE_WAITPID(pid[i], &status, WUNTRACED | WCONTINUED);
> > >
> > > -             if (overcommit_policy == 2) {
> > > -                     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)
> > > -                             tst_res(TFAIL,
> > > -                                      "child unexpectedly failed: %d",
> > > -                                      status);
> > > -             } else if (overcommit_policy == 1) {
> > > -                     if (!WIFSIGNALED(status) || WTERMSIG(status) !=
> > SIGKILL)
> > > +             if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
> > > +                     tst_res(TFAIL,
> > > +                             "child unexpectedly failed: %d", status);
> > > +             } else if (WIFSIGNALED(status) && WTERMSIG(status) !=
> > SIGKILL) {
> > >  #if __WORDSIZE == 32
> > > -                     {
> > > -                             if (total_mem < 3145728UL)
> > > +                     if (total_mem < 3145728UL)
> > >  #endif
> > > -                                     tst_res(TFAIL,
> > > -                                              "child unexpectedly
> > failed: %d",
> > > -                                              status);
> > > +                             tst_res(TFAIL,
> > > +                                     "child unexpectedly failed: %d",
> > status);
> > >  #if __WORDSIZE == 32
> > > -                             /* in 32-bit system, a process allocate
> > about 3Gb memory at most */
> > > -                             else
> > > -                                     tst_res(TINFO, "Child can't
> > allocate "
> > > -                                              ">3Gb memory in 32bit
> > system");
> > > -                     }
> > > +                     /* in 32-bit system, a process allocate about 3Gb
> > memory at most */
> > > +                     else
> > > +                             tst_res(TINFO, "Child can't allocate "
> > > +                                     ">3Gb memory in 32bit system");
> > >  #endif
> > > -             } else {
> > > -                     if (WIFEXITED(status)) {
> > > -                             if (WEXITSTATUS(status) != 0) {
> > > -                                     tst_res(TFAIL, "child unexpectedly
> > "
> > > -                                              "failed: %d", status);
> > > -                             }
> > > -                     } else if (!WIFSIGNALED(status) ||
> > > -                                WTERMSIG(status) != SIGKILL) {
> > > -                             tst_res(TFAIL,
> > > -                                      "child unexpectedly failed: %d",
> > > -                                      status);
> > > -                     }
> > >               }
> > >       }
> > >  }
> > > --
> > > 2.20.1
> > >
> > >
> >
> 
> 
> --
> Regards,
> Li Wang
> 

      reply	other threads:[~2019-03-20  8:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-19  9:38 [LTP] [PATCH RFC 1/3] min_free_kbytes: Fix child exit status check conditions Li Wang
2019-03-19  9:38 ` [LTP] [PATCH RFC 2/3] min_free_kbytes: enable check_monitor in background Li Wang
2019-03-19  9:38   ` [LTP] [PATCH RFC 3/3] min_free_kbytes: allow MemFree to fluctuate nearby min_pages Li Wang
2019-03-19 16:30 ` [LTP] [PATCH RFC 1/3] min_free_kbytes: Fix child exit status check conditions Jan Stancek
2019-03-20  6:11   ` Li Wang
2019-03-20  8:10     ` Jan Stancek [this message]

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=1928792373.10466963.1553069404279.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox