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] mem/lib: Keep KSM off when child_alloc() allocate memory in single thread
Date: Tue, 21 Jun 2016 03:00:29 -0400 (EDT)	[thread overview]
Message-ID: <1793371138.555301.1466492429338.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1466480392-25837-1-git-send-email-liwang@redhat.com>



----- Original Message -----
> From: "Li Wang" <liwang@redhat.com>
> To: jstancek@redhat.com
> Cc: ltp@lists.linux.it
> Sent: Tuesday, 21 June, 2016 5:39:52 AM
> Subject: [PATCH] mem/lib: Keep KSM off when child_alloc() allocate memory in single thread

The single thread is not important here, it's how much that allocation
contributes to limit_in_bytes. oom01 on 2 CPU system will do all
allocations in single thread and KSM won't be turned off.

> 
> 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 issue was occurred
> because child_alloc() go into single(lite == 1) thread mode but successfully
> finish the memory allocation and return 0. A probably reason is that KSM
> scan merged same pages and disturbed the OOM test in cgroup.
> 
> In this patch, keep KSM scan off to prevent OOM test in cgroup distrubing.
> 
> Signed-off-by: Li Wang <liwang@redhat.com>
> ---
>  testcases/kernel/mem/lib/mem.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 3d853a3..b43b7f8 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -230,7 +230,9 @@ void testoom(int mempolicy, int lite, int retcode, int
> allow_sigkill)
>  	} else {
>  		tst_resm(TINFO, "start OOM testing for KSM pages.");
>  		SAFE_FILE_SCANF(cleanup, PATH_KSM "run", "%d", &ksm_run_orig);
> -		SAFE_FILE_PRINTF(cleanup, PATH_KSM "run", "1");
> +		/* Let KSM off if lite == 1, since limit_in_bytes may vary from
> +		 * run to run, which isn't reliable for oom03 cgroup test.*/
> +		if (!lite) SAFE_FILE_PRINTF(cleanup, PATH_KSM "run", "1");
>  		oom(KSM, lite, retcode, allow_sigkill);
>  		SAFE_FILE_PRINTF(cleanup,PATH_KSM "run", "%d", ksm_run_orig);
>  	}

What if KSM was enabled before test started?

I'd skip this entire else block if lite == 1. With KSM off, it's nearly
identical to oom(NORMAL).

Regards,
Jan

  reply	other threads:[~2016-06-21  7:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-21  3:39 [LTP] [PATCH] mem/lib: Keep KSM off when child_alloc() allocate memory in single thread Li Wang
2016-06-21  7:00 ` Jan Stancek [this message]
2016-06-21  7:56   ` Li Wang
2016-06-21  8:39     ` Jan Stancek
2016-06-21  9:07       ` 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=1793371138.555301.1466492429338.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