<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">@Vipin, is there any possible you can have a look Jan's question?<br class="gmail-Apple-interchange-newline"></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 20, 2019 at 12:30 AM Jan Stancek <<a href="mailto:jstancek@redhat.com">jstancek@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
----- Original Message -----<br>
> From: Vipin K Parashar <<a href="mailto:vipin@linux.vnet.ibm.com" target="_blank">vipin@linux.vnet.ibm.com</a>><br>
> <br>
> Fixes: #349<br>
> <br>
> min_free_kbytes test has badly formed if conditions in mem_tune()<br>
> for child exit status check. <br>
<br>
Can you please elaborate what's wrong about it?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">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.</div></div><div class="gmail_default"><a href="https://github.com/linux-test-project/ltp/pull/350">https://github.com/linux-test-project/ltp/pull/350</a><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> This is causing test to declare as FAILED<br>
> despite that not being the case.<br>
<br>
Why? Shouldn't mmap succeed with overcommit == 1?<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I was unable to reproduce this. But AFAIK, 'overcommit == 1' cann't guarantee the MAP_FAILED(with ENOMEM) before oom. So I roughly made change in the original patch to catch up both oom and map_failed scenario for any 'overcommit'.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">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.</div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
> Fix child exit status check conditions.<br>
> <br>
> ---ERROR LOG---<br>
> <..snip..><br>
> mem.c:839: INFO: set overcommit_memory to 1<br>
> mem.c:839: INFO: set min_free_kbytes to 11580<br>
> memfree is 6974720 kB before eatup mem<br>
> memfree is 15488 kB after eatup mem<br>
> min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0<br>
> mem.c:839: INFO: set min_free_kbytes to 23160<br>
> memfree is 7104128 kB before eatup mem<br>
> memfree is 26560 kB after eatup mem<br>
> min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0<br>
> mem.c:839: INFO: set min_free_kbytes to 145812<br>
> memfree is 7101504 kB before eatup mem<br>
> memfree is 215872 kB after eatup mem<br>
> min_free_kbytes.c:135: FAIL: child unexpectedly failed: 0<br>
> min_free_kbytes.c:81: PASS: min_free_kbytes test pass<br>
> mem.c:839: INFO: set min_free_kbytes to 11580<br>
> ---------------<br>
> <br>
> Signed-off-by: Vipin K Parashar <<a href="mailto:vipin@linux.vnet.ibm.com" target="_blank">vipin@linux.vnet.ibm.com</a>><br>
> Signed-off-by: Li Wang <<a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a>><br>
> Cc: Jan Stancek <<a href="mailto:jstancek@redhat.com" target="_blank">jstancek@redhat.com</a>><br>
> ---<br>
>  .../kernel/mem/tunable/min_free_kbytes.c      | 40 +++++--------------<br>
>  1 file changed, 11 insertions(+), 29 deletions(-)<br>
> <br>
> diff --git a/testcases/kernel/mem/tunable/min_free_kbytes.c<br>
> b/testcases/kernel/mem/tunable/min_free_kbytes.c<br>
> index f114dc493..d2378a700 100644<br>
> --- a/testcases/kernel/mem/tunable/min_free_kbytes.c<br>
> +++ b/testcases/kernel/mem/tunable/min_free_kbytes.c<br>
> @@ -119,39 +119,21 @@ static void test_tune(unsigned long overcommit_policy)<br>
>  <br>
>               SAFE_WAITPID(pid[i], &status, WUNTRACED | WCONTINUED);<br>
>  <br>
> -             if (overcommit_policy == 2) {<br>
> -                     if (!WIFEXITED(status) || WEXITSTATUS(status) != 0)<br>
> -                             tst_res(TFAIL,<br>
> -                                      "child unexpectedly failed: %d",<br>
> -                                      status);<br>
> -             } else if (overcommit_policy == 1) {<br>
> -                     if (!WIFSIGNALED(status) || WTERMSIG(status) != SIGKILL)<br>
> +             if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {<br>
> +                     tst_res(TFAIL,<br>
> +                             "child unexpectedly failed: %d", status);<br>
> +             } else if (WIFSIGNALED(status) && WTERMSIG(status) != SIGKILL) {<br>
>  #if __WORDSIZE == 32<br>
> -                     {<br>
> -                             if (total_mem < 3145728UL)<br>
> +                     if (total_mem < 3145728UL)<br>
>  #endif<br>
> -                                     tst_res(TFAIL,<br>
> -                                              "child unexpectedly failed: %d",<br>
> -                                              status);<br>
> +                             tst_res(TFAIL,<br>
> +                                     "child unexpectedly failed: %d", status);<br>
>  #if __WORDSIZE == 32<br>
> -                             /* in 32-bit system, a process allocate about 3Gb memory at most */<br>
> -                             else<br>
> -                                     tst_res(TINFO, "Child can't allocate "<br>
> -                                              ">3Gb memory in 32bit system");<br>
> -                     }<br>
> +                     /* in 32-bit system, a process allocate about 3Gb memory at most */<br>
> +                     else<br>
> +                             tst_res(TINFO, "Child can't allocate "<br>
> +                                     ">3Gb memory in 32bit system");<br>
>  #endif<br>
> -             } else {<br>
> -                     if (WIFEXITED(status)) {<br>
> -                             if (WEXITSTATUS(status) != 0) {<br>
> -                                     tst_res(TFAIL, "child unexpectedly "<br>
> -                                              "failed: %d", status);<br>
> -                             }<br>
> -                     } else if (!WIFSIGNALED(status) ||<br>
> -                                WTERMSIG(status) != SIGKILL) {<br>
> -                             tst_res(TFAIL,<br>
> -                                      "child unexpectedly failed: %d",<br>
> -                                      status);<br>
> -                     }<br>
>               }<br>
>       }<br>
>  }<br>
> --<br>
> 2.20.1<br>
> <br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div></div></div></div></div></div></div>