public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Caspar Zhang <caspar@casparzhang.com>
To: Zhouping Liu <zliu@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH] mm: fixed nodemask args in set_mempolicy()
Date: Tue, 15 May 2012 19:16:56 +0800	[thread overview]
Message-ID: <4FB23B28.1080103@casparzhang.com> (raw)
In-Reply-To: <1337078857-6487-1-git-send-email-zliu@redhat.com>

On 05/15/2012 06:47 PM, Zhouping Liu wrote:
> inside oom0[2|4], ksm0[2|4] cases, they are running under
> numa system, and allocte memory in the second numa node,
> set nodemask 2, which indicates all memory allocated in
> node1, but when a numa system don't have node1, these cases
> will failed, such like the box, available nodes: (0,2,4,7)
> 
>  [root@hp-magnycours-01 oom]# ./oom02
>  oom02       0  TINFO  :  set overcommit_memory to 1
>  oom02       0  TINFO  :  process mempolicy.
>  oom02       0  TINFO  :  start normal OOM testing.
>  oom02       0  TINFO  :  expected victim is 9112.
>  oom02       1  TBROK  :  set_mempolicy: errno=EINVAL(22): Invalid argument
>  oom02       2  TBROK  :  Remaining cases broken
>  oom02       0  TINFO  :  set overcommit_memory to 0
>  oom02       1  TFAIL  :  the victim unexpectedly failed: 512
>  oom02       0  TINFO  :  start OOM testing for mlocked pages.
>  ...
> 
> the patch fixed the above issue.
> 
> Also inside cpuset01 case, depend on the reproducer, mem hog thread
> allocated memory on *all* nodes, but 'nmask += exp2f(i);' can't
> do that, and the patch fixed it.
> 
> Signed-off-by: Zhouping Liu <zliu@redhat.com>
> ---
>  testcases/kernel/mem/cpuset/cpuset01.c |    2 +-
>  testcases/kernel/mem/ksm/ksm02.c       |    3 ++-
>  testcases/kernel/mem/ksm/ksm04.c       |    3 ++-
>  testcases/kernel/mem/lib/mem.c         |    5 ++++-
>  4 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/testcases/kernel/mem/cpuset/cpuset01.c b/testcases/kernel/mem/cpuset/cpuset01.c
> index 09159f2..b20485f 100644
> --- a/testcases/kernel/mem/cpuset/cpuset01.c
> +++ b/testcases/kernel/mem/cpuset/cpuset01.c
> @@ -108,7 +108,7 @@ static void testcpuset(void)
>  		tst_brkm(TBROK|TERRNO, cleanup, "fork");
>  	case 0:
>  		for (i = 0; i < nnodes; i++)
> -			nmask += exp2f(i);
> +			nmask += 1 << nodes[i];
>  		if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1)
>  			tst_brkm(TBROK|TERRNO, cleanup, "set_mempolicy");
>  		exit(mem_hog_cpuset(ncpus > 1 ? ncpus : 1));
> diff --git a/testcases/kernel/mem/ksm/ksm02.c b/testcases/kernel/mem/ksm/ksm02.c
> index 3bfcaa6..92f1493 100644
> --- a/testcases/kernel/mem/ksm/ksm02.c
> +++ b/testcases/kernel/mem/ksm/ksm02.c
> @@ -87,7 +87,7 @@ int main(int argc, char *argv[])
>  	int lc;
>  	char *msg;
>  	int size = 128, num = 3, unit = 1;
> -	unsigned long nmask = 2;
> +	unsigned long nmask = 0;
>  	long nodes[MAXNODES];
>  
>  	msg = parse_opts(argc, argv, ksm_options, ksm_usage);
> @@ -103,6 +103,7 @@ int main(int argc, char *argv[])
>  		Tst_count = 0;
>  		check_ksm_options(&size, &num, &unit);
>  
> +		nmask = 1 << nodes[1];
>  		if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1) {
>  			if (errno != ENOSYS)
>  				tst_brkm(TBROK|TERRNO, cleanup,
> diff --git a/testcases/kernel/mem/ksm/ksm04.c b/testcases/kernel/mem/ksm/ksm04.c
> index 8bbf067..8a31051 100644
> --- a/testcases/kernel/mem/ksm/ksm04.c
> +++ b/testcases/kernel/mem/ksm/ksm04.c
> @@ -87,7 +87,7 @@ int main(int argc, char *argv[])
>  	int lc;
>  	char *msg;
>  	int size = 128, num = 3, unit = 1;
> -	unsigned long nmask = 2;
> +	unsigned long nmask = 0;
>  	long nodes[MAXNODES];
>  
>  	msg = parse_opts(argc, argv, ksm_options, ksm_usage);
> @@ -105,6 +105,7 @@ int main(int argc, char *argv[])
>  
>  		write_memcg();
>  
> +		nmask = 1 << nodes[1];
>  		if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1) {
>  			if (errno != ENOSYS)
>  				tst_brkm(TBROK|TERRNO, cleanup,
> diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
> index 7289812..b031184 100644
> --- a/testcases/kernel/mem/lib/mem.c
> +++ b/testcases/kernel/mem/lib/mem.c
> @@ -66,7 +66,8 @@ void oom(int testcase, int mempolicy, int lite)
>  	int status;
>  #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
>  	&& HAVE_MPOL_CONSTANTS
> -	unsigned long nmask = 2;
> +	unsigned long nmask = 0;
> +	long nodes[MAXNODES];
>  #endif
>  
>  	switch (pid = fork()) {
> @@ -75,6 +76,8 @@ void oom(int testcase, int mempolicy, int lite)
>  	case 0:
>  #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
>  	&& HAVE_MPOL_CONSTANTS
> +		count_numa(nodes);
> +		nmask += 1 << nodes[1];
>  		if (mempolicy)
>  			if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1)
>  				tst_brkm(TBROK|TERRNO, cleanup,

looks good.

Reviewed-by: Caspar Zhang <caspar@casparzhang.com>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2012-05-15 11:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-15 10:47 [LTP] [PATCH] mm: fixed nodemask args in set_mempolicy() Zhouping Liu
2012-05-15 11:16 ` Caspar Zhang [this message]
2012-05-15 11:23   ` Wanlong Gao

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=4FB23B28.1080103@casparzhang.com \
    --to=caspar@casparzhang.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=zliu@redhat.com \
    /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