All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanlong Gao <gaowanlong@cn.fujitsu.com>
To: Zhouping Liu <zliu@redhat.com>
Cc: LTP List <ltp-list@lists.sourceforge.net>
Subject: Re: [LTP] [PATCH v3 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03
Date: Tue, 19 Mar 2013 11:10:27 +0800	[thread overview]
Message-ID: <5147D723.2060001@cn.fujitsu.com> (raw)
In-Reply-To: <2ccf451c55f261c878bdd388e1e1741d2d9c037c.1363579539.git.zliu@redhat.com>

On 03/18/2013 12:14 PM, Zhouping Liu wrote:
> OOM with the combination of memcg & numa was moved to oom03,
> and oom04 is re-design to be used to test 'OOM with CPUSET'.
> 
> also used is_numa() instead of the old method.
> 
> Signed-off-by: Zhouping Liu <zliu@redhat.com>
> ---
>  testcases/kernel/mem/oom/oom02.c |  6 ++--
>  testcases/kernel/mem/oom/oom03.c | 20 ++++++++++++++
>  testcases/kernel/mem/oom/oom04.c | 60 +++++++++++++++-------------------------
>  3 files changed, 46 insertions(+), 40 deletions(-)
> 
> diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
> index 31ec73f..3bc8567 100644
> --- a/testcases/kernel/mem/oom/oom02.c
> +++ b/testcases/kernel/mem/oom/oom02.c
> @@ -35,6 +35,7 @@
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <stdio.h>
> +#include "numa_helper.h"
>  #include "test.h"
>  #include "usctest.h"
>  #include "mem.h"
> @@ -44,7 +45,6 @@ int TST_TOTAL = 1;
>  
>  #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
>  	&& HAVE_MPOL_CONSTANTS
> -#include <numaif.h>
>  
>  int main(int argc, char *argv[])
>  {
> @@ -83,8 +83,8 @@ void setup(void)
>  	tst_sig(FORK, DEF_HANDLER, cleanup);
>  	TEST_PAUSE;
>  
> -	/* Judge a NUMA system through get_a_numa_node */
> -	get_a_numa_node(NULL);
> +	if (!is_numa(NULL))
> +		tst_brkm(TCONF, NULL, "The case need a NUMA system.");
>  
>  	overcommit = get_sys_tune("overcommit_memory");
>  	set_sys_tune("overcommit_memory", 1, 1);
> diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
> index 95e34d5..c2171fd 100644
> --- a/testcases/kernel/mem/oom/oom03.c
> +++ b/testcases/kernel/mem/oom/oom03.c
> @@ -33,6 +33,7 @@
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <stdio.h>
> +#include "numa_helper.h"
>  #include "test.h"
>  #include "usctest.h"
>  #include "mem.h"
> @@ -40,6 +41,9 @@
>  char *TCID = "oom03";
>  int TST_TOTAL = 1;
>  
> +#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
> +	&& HAVE_MPOL_CONSTANTS
> +
>  int main(int argc, char *argv[])
>  {
>  	char *msg;
> @@ -76,6 +80,14 @@ int main(int argc, char *argv[])
>  			write_file(MEMCG_SW_LIMIT, mem);
>  			testoom(0, 1, 0);
>  		}
> +
> +		/* OOM for MEMCG with mempolicy */
> +		if (is_numa(cleanup)) {
> +			tst_resm(TINFO, "OOM on MEMCG & mempolicy...");
> +			testoom(MPOL_BIND, 0, 1);
> +			testoom(MPOL_INTERLEAVE, 0, 1);
> +			testoom(MPOL_PREFERRED, 0, 1);
> +		}
>  	}
>  	cleanup();
>  	tst_exit();
> @@ -99,3 +111,11 @@ void cleanup(void)
>  
>  	TEST_CLEANUP;
>  }
> +
> +#else
> +int main(void)
> +{
> +	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
> +}
> +#endif
> +

Here added a new line at EOF, if you want to just modify the patch,
please remove this line, and change "@@ -99,3 +111,11" to "@@ -99,3 +111,10".

Thanks,
Wanlong Gao

> diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
> index bc51046..1ad7334 100644
> --- a/testcases/kernel/mem/oom/oom04.c
> +++ b/testcases/kernel/mem/oom/oom04.c
> @@ -1,5 +1,5 @@
>  /*
> - * Out Of Memory (OOM) for Memory Resource Controller and NUMA
> + * Out Of Memory (OOM) for CPUSET
>   *
>   * The program is designed to cope with unpredictable like amount and
>   * system physical memory, swap size and other VMM technology like KSM,
> @@ -35,6 +35,7 @@
>  #include <errno.h>
>  #include <fcntl.h>
>  #include <stdio.h>
> +#include "numa_helper.h"
>  #include "test.h"
>  #include "usctest.h"
>  #include "mem.h"
> @@ -44,12 +45,11 @@ int TST_TOTAL = 1;
>  
>  #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
>  	&& HAVE_MPOL_CONSTANTS
> +
>  int main(int argc, char *argv[])
>  {
>  	char *msg;
>  	int lc;
> -	int swap_acc_on = 1;
> -	char buf[BUFSIZ], mem[BUFSIZ];
>  
>  	msg = parse_opts(argc, argv, NULL, NULL);
>  	if (msg != NULL)
> @@ -64,38 +64,19 @@ int main(int argc, char *argv[])
>  	for (lc = 0; TEST_LOOPING(lc); lc++) {
>  		tst_count = 0;
>  
> -		snprintf(buf, BUFSIZ, "%d", getpid());
> -		write_file(MEMCG_PATH_NEW "/tasks", buf);
> -
> -		snprintf(mem, BUFSIZ, "%ld", TESTMEM);
> -		write_file(MEMCG_PATH_NEW "/memory.limit_in_bytes", mem);
> -
> -		if (access(MEMCG_SW_LIMIT, F_OK) == -1) {
> -			if (errno == ENOENT) {
> -				tst_resm(TCONF,
> -					 "memcg swap accounting is disabled");
> -				swap_acc_on = 0;
> -			} else
> -				tst_brkm(TBROK | TERRNO, cleanup, "access");
> -		}
> -
> -		tst_resm(TINFO, "process mempolicy.");
> -		testoom(1, 0, 1);
> -
> -		if (swap_acc_on) {
> -			write_file(MEMCG_SW_LIMIT, mem);
> -			testoom(1, 1, 1);
> -		}
> -
> -		tst_resm(TINFO, "process cpuset.");
> -
> -		if (swap_acc_on)
> -			write_file(MEMCG_SW_LIMIT, "-1");
> -		testoom(0, 0, 1);
> -
> -		if (swap_acc_on) {
> -			write_file(MEMCG_SW_LIMIT, mem);
> -			testoom(0, 1, 1);
> +		tst_resm(TINFO, "OOM on CPUSET...");
> +		testoom(0, 0, 0);
> +
> +		if (is_numa(cleanup)) {
> +			/*
> +			 * Under NUMA system, the migration of cpuset's memory
> +			 * is in charge of cpuset.memory_migrate, we can write
> +			 * 1 to cpuset.memory_migrate to enable the migration.
> +			 */
> +			write_cpuset_files(CPATH_NEW,
> +					   "memory_migrate", "1");
> +			tst_resm(TINFO, "OOM on CPUSET with mem migrate:");
> +			testoom(0, 0, 0);
>  		}
>  	}
>  	cleanup();
> @@ -110,15 +91,20 @@ void setup(void)
>  
>  	overcommit = get_sys_tune("overcommit_memory");
>  	set_sys_tune("overcommit_memory", 1, 1);
> +
>  	mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
> -	mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
> +	if (is_numa(cleanup) > 0)
> +		/* For NUMA system, using the first node for cpuset.mems */
> +		write_cpusets(get_a_numa_node(cleanup));
> +	else
> +		/* For nonNUMA system, using node0 for cpuset.mems */
> +		write_cpusets(0);
>  }
>  
>  void cleanup(void)
>  {
>  	set_sys_tune("overcommit_memory", overcommit, 0);
>  	umount_mem(CPATH, CPATH_NEW);
> -	umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
>  
>  	TEST_CLEANUP;
>  }
> 


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

  reply	other threads:[~2013-03-19  3:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-18  4:13 [LTP] [PATCH v3 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
2013-03-18  4:13 ` [LTP] [PATCH v3 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
2013-03-18  4:13 ` [LTP] [PATCH v3 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy' Zhouping Liu
2013-03-18  4:14 ` [LTP] [PATCH v3 3/7] numa_helper: added a new function is_numa() Zhouping Liu
2013-03-18  4:14 ` [LTP] [PATCH v3 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03 Zhouping Liu
2013-03-19  3:10   ` Wanlong Gao [this message]
2013-03-19  3:30     ` Zhouping Liu
2013-03-18  4:14 ` [LTP] [PATCH v3 5/7] lib/mem: updated testoom() and oom() funcs Zhouping Liu
2013-03-18  4:14 ` [LTP] [PATCH v3 6/7] mm/oom05: new testcase Zhouping Liu
2013-03-19  3:12   ` Wanlong Gao
2013-03-18  4:14 ` [LTP] [PATCH v3 7/7] lib/mem: removed the prefix underscore '_' of the internal function name Zhouping Liu
2013-03-19  3:13 ` [LTP] [PATCH v3 0/7] mm/oom: extend the coverage of OOM Wanlong Gao
2013-03-20  9:56 ` 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=5147D723.2060001@cn.fujitsu.com \
    --to=gaowanlong@cn.fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.