From: Li Wang <liwang@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 17:53:05 +0800 [thread overview]
Message-ID: <1466416385-20603-1-git-send-email-liwang@redhat.com> (raw)
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.
In this patch, let's make it (in single mode) keep allocating memory with
an incresed length in order to avoid 0 returned.
Signed-off-by: Li Wang <liwang@redhat.com>
---
testcases/kernel/mem/lib/mem.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 3d853a3..c1f91ce 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -70,11 +70,17 @@ static void *child_alloc_thread(void *args)
static void child_alloc(int testcase, int lite, int threads)
{
- int i;
+ int i, ret;
pthread_t *th;
if (lite) {
- int ret = alloc_mem(TESTMEM + MB, testcase);
+ long length = TESTMEM + MB;
+
+ /* keep allocating until there's an error */
+ while (!ret) {
+ ret = alloc_mem(length, testcase);
+ length += MB;
+ }
exit(ret);
}
--
1.8.3.1
next reply other threads:[~2016-06-20 9:53 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-20 9:53 Li Wang [this message]
2016-06-20 10:43 ` [LTP] [PATCH] mem/lib: keep allocating memory until get an error in single process Jan Stancek
2016-06-20 11:34 ` Li Wang
2016-06-20 13:03 ` Jan Stancek
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=1466416385-20603-1-git-send-email-liwang@redhat.com \
--to=liwang@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