All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM
@ 2013-03-19  3:40 Zhouping Liu
  2013-03-19  3:40 ` [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

changed log from v1 to v2:
 1. added a new is_numa() function instead of ISNUMA global variable;
 2. added new patch to remove the prefix underscroe '_' of the
    internal function name;
 3. used SAFE_FILE_SCANF() instead of read_file().
 4. some cleanup...

changed log from v2 to v3:
 1. as Jan's suggestion, pass 'nodes=NULL' to get_allowed_nodes_arr()
    in is_numa(), and free 'nodes' variable when it passed a non-NULL
    value inside testoom().

changed log from v3 to v4:
 1. fixed some patch style error

The patch set updated all OOM testcases, and added a new testcase.

Inside old version, OOM only test MPOL_MBIND mempolicy in NUMA
system, and the combination of CPUSET, MEMCG & NUMA is complex,
and not clear. Also CPUSET is only used in NUMA system.

These patch set adjust them, now we can coverage the below tests:
 1) OOM under normal - oom01
 2) OOM under all mempolicy - oom02
 3) OOM under MEMCG (+ mempolicy) - oom03
 4) OOM under CPUSET (+ mempolicy)  - oom04
 5) OOM under CPUSET & MEMCG - oom05

Zhouping Liu (7):
  lib/mem: modified _gather_cpus() as _gather_node_cpus()
  mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy'
  numa_helper: added a new function is_numa()
  mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG &
    numa' to oom03
  lib/mem: updated testoom() and oom() funcs
  mm/oom05: new testcase
  lib/mem: removed the prefix underscore '_' of the internal function
    name

 runtest/mm                             |   1 +
 testcases/kernel/include/numa_helper.h |   1 +
 testcases/kernel/lib/numa_helper.c     |  24 ++++++
 testcases/kernel/mem/include/mem.h     |   4 +-
 testcases/kernel/mem/lib/mem.c         | 147 +++++++++++++++++++++------------
 testcases/kernel/mem/oom/oom01.c       |   6 +-
 testcases/kernel/mem/oom/oom02.c       |  20 +++--
 testcases/kernel/mem/oom/oom03.c       |  23 +++++-
 testcases/kernel/mem/oom/oom04.c       |  60 ++++++--------
 testcases/kernel/mem/oom/oom05.c       | 147 +++++++++++++++++++++++++++++++++
 10 files changed, 328 insertions(+), 105 deletions(-)
 create mode 100644 testcases/kernel/mem/oom/oom05.c

-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus()
  2013-03-19  3:40 [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
@ 2013-03-19  3:40 ` Zhouping Liu
  2013-03-19  3:40   ` [LTP] [PATCH v4 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy' Zhouping Liu
  2013-03-20  9:58 ` [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Wanlong Gao
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

The previous _gather_cpus() tried to collect all the specified
node's cpus, but it didn't pay attention to the offline cpus,
if one cpu in the specified node were offline, it can't write
the cpu number to cgroups/*.cpus, and return -EINVAL.

The patch fixed it, and modified the function name, as the new
name make more sense.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/mem/lib/mem.c | 26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index a827b25..72ac06d 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -20,6 +20,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "safe_macros.h"
+#include "safe_file_ops.h"
 #include "_private.h"
 #include "mem.h"
 #include "numa_helper.h"
@@ -481,20 +482,37 @@ void ksm_usage(void)
 
 /* cpuset/memcg */
 
-static void _gather_cpus(char *cpus, long nd)
+static void _gather_node_cpus(char *cpus, long nd)
 {
 	int ncpus = 0;
 	int i;
+	long online;
 	char buf[BUFSIZ];
+	char path[BUFSIZ], path1[BUFSIZ];
 
 	while (path_exist(PATH_SYS_SYSTEM "/cpu/cpu%d", ncpus))
 		ncpus++;
 
-	for (i = 0; i < ncpus; i++)
-		if (path_exist(PATH_SYS_SYSTEM "/node/node%ld/cpu%d", nd, i)) {
+	for (i = 0; i < ncpus; i++) {
+		snprintf(path, BUFSIZ,
+			 PATH_SYS_SYSTEM "/node/node%ld/cpu%d", nd, i);
+		if (path_exist(path, nd, i)) {
+			snprintf(path1, BUFSIZ, "%s/online", path);
+			/*
+			 * No cpu0/online knob, as it can't support to
+			 * on/offline cpu0, so if the 'nd' node contains
+			 * cpu0, it should skip to check cpu0/online's value.
+			 */
+			if (i == 0)
+				goto next;
+			SAFE_FILE_SCANF(cleanup, path1, "%ld", &online);
+			if (online == 0)
+				continue;
+next:
 			sprintf(buf, "%d,", i);
 			strcat(cpus, buf);
 		}
+	}
 	/* Remove the trailing comma. */
 	cpus[strlen(cpus) - 1] = '\0';
 }
@@ -563,7 +581,7 @@ void write_cpusets(long nd)
 	snprintf(buf, BUFSIZ, "%ld", nd);
 	write_cpuset_files(CPATH_NEW, "mems", buf);
 
-	_gather_cpus(cpus, nd);
+	_gather_node_cpus(cpus, nd);
 	write_cpuset_files(CPATH_NEW, "cpus", cpus);
 
 	snprintf(buf, BUFSIZ, "%d", getpid());
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy'
  2013-03-19  3:40 ` [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
@ 2013-03-19  3:40   ` Zhouping Liu
  2013-03-19  3:40     ` [LTP] [PATCH v4 3/7] numa_helper: added a new function is_numa() Zhouping Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

NUMA mechanism can be interpreted as 'memory policy', there are
several mempolicys, such as MPOL_BIND, MPOL_INTERLEAVE,
MPOL_PREFERRED etc, not only MPOL_BIND, so the patch extended OOM
on NUMA system, added MPOL_INTERLEAVE and MPOL_PREFERRED mempolicy.

And the patch also moved 'set_mempolicy()' from child process, and
made it executed inside testoom() func, which is easy to control.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/mem/lib/mem.c   | 58 ++++++++++++++++++++++++++++------------
 testcases/kernel/mem/oom/oom02.c | 20 +++++++++-----
 2 files changed, 54 insertions(+), 24 deletions(-)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 72ac06d..0b8974c 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -65,32 +65,17 @@ void oom(int testcase, int mempolicy, int lite)
 {
 	pid_t pid;
 	int status;
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-	unsigned long nmask = 0;
-	unsigned int node;
-
-	if (mempolicy)
-		node = get_a_numa_node(cleanup);
-	nmask += 1 << node;
-#endif
 
 	switch (pid = fork()) {
 	case -1:
 		tst_brkm(TBROK | TERRNO, cleanup, "fork");
 	case 0:
-#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
-	&& HAVE_MPOL_CONSTANTS
-		if (mempolicy)
-			if (set_mempolicy(MPOL_BIND, &nmask, MAXNODES) == -1)
-				tst_brkm(TBROK | TERRNO, cleanup,
-					 "set_mempolicy");
-#endif
 		_test_alloc(testcase, lite);
 		exit(0);
 	default:
 		break;
 	}
+
 	tst_resm(TINFO, "expected victim is %d.", pid);
 	if (waitpid(-1, &status, 0) == -1)
 		tst_brkm(TBROK | TERRNO, cleanup, "waitpid");
@@ -108,7 +93,46 @@ void oom(int testcase, int mempolicy, int lite)
 
 void testoom(int mempolicy, int lite, int numa)
 {
-	long nodes[MAXNODES];
+#if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
+	&& HAVE_MPOL_CONSTANTS
+	unsigned long nmask = 0;
+	unsigned int num_nodes, *nodes;
+	int ret;
+
+	if (mempolicy) {
+		ret = get_allowed_nodes_arr(NH_MEMS|NH_CPUS, &num_nodes, &nodes);
+		if (ret != 0)
+			tst_brkm(TBROK|TERRNO, cleanup,
+				 "get_allowed_nodes_arr");
+		if (num_nodes < 2) {
+			tst_resm(TINFO, "mempolicy need NUMA system support");
+			free(nodes);
+			return;
+		}
+		switch(mempolicy) {
+		case MPOL_BIND:
+			/* bind the second node */
+			nmask = 1 << nodes[1];
+			break;
+		case MPOL_INTERLEAVE:
+		case MPOL_PREFERRED:
+			if (num_nodes == 2) {
+				tst_resm(TINFO, "The mempolicy need "
+					 "more than 2 numa nodes");
+				free(nodes);
+				return;
+			} else {
+				/* Using the 2nd,3rd node */
+				nmask = (1 << nodes[1]) | (1 << nodes[2]);
+			}
+			break;
+		default:
+			tst_brkm(TBROK|TERRNO, cleanup, "Bad mempolicy mode");
+		}
+		if (set_mempolicy(mempolicy, &nmask, MAXNODES) == -1)
+			tst_brkm(TBROK|TERRNO, cleanup, "set_mempolicy");
+	}
+#endif
 
 	if (numa && !mempolicy)
 		write_cpusets(get_a_numa_node(cleanup));
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index abd8aa2..31ec73f 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -1,5 +1,5 @@
 /*
- * Out Of Memory (OOM) for NUMA
+ * Out Of Memory (OOM) for mempolicy - need NUMA system support
  *
  * The program is designed to cope with unpredictable like amount and
  * system physical memory, swap size and other VMM technology like KSM,
@@ -44,6 +44,8 @@ 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[])
 {
 	char *msg;
@@ -62,11 +64,14 @@ int main(int argc, char *argv[])
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		tst_count = 0;
 
-		tst_resm(TINFO, "process mempolicy.");
-		testoom(1, 0, 1);
+		tst_resm(TINFO, "OOM on MPOL_BIND mempolicy...");
+		testoom(MPOL_BIND, 0, 1);
+
+		tst_resm(TINFO, "OOM on MPOL_INTERLEAVE mempolicy...");
+		testoom(MPOL_INTERLEAVE, 0, 1);
 
-		tst_resm(TINFO, "process cpuset.");
-		testoom(0, 0, 1);
+		tst_resm(TINFO, "OOM on MPOL_PREFERRED mempolicy...");
+		testoom(MPOL_PREFERRED, 0, 1);
 	}
 	cleanup();
 	tst_exit();
@@ -78,15 +83,16 @@ 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);
+
 	overcommit = get_sys_tune("overcommit_memory");
 	set_sys_tune("overcommit_memory", 1, 1);
-	mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
 }
 
 void cleanup(void)
 {
 	set_sys_tune("overcommit_memory", overcommit, 0);
-	umount_mem(CPATH, CPATH_NEW);
 
 	TEST_CLEANUP;
 }
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 3/7] numa_helper: added a new function is_numa()
  2013-03-19  3:40   ` [LTP] [PATCH v4 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy' Zhouping Liu
@ 2013-03-19  3:40     ` Zhouping Liu
  2013-03-19  3:40       ` [LTP] [PATCH v4 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03 Zhouping Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

Added a new function is_numa(), which is desinged to judge
whether a system contains more than 1 available numa nodes
or not, and lots of cases need it.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/include/numa_helper.h |  1 +
 testcases/kernel/lib/numa_helper.c     | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/testcases/kernel/include/numa_helper.h b/testcases/kernel/include/numa_helper.h
index 8e82d7b..251fd54 100644
--- a/testcases/kernel/include/numa_helper.h
+++ b/testcases/kernel/include/numa_helper.h
@@ -34,5 +34,6 @@ unsigned long get_max_node(void);
 int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
 int get_allowed_nodes(int flag, int count, ...);
 void nh_dump_nodes();
+int is_numa(void (*cleanup_fn)(void));
 
 #endif
diff --git a/testcases/kernel/lib/numa_helper.c b/testcases/kernel/lib/numa_helper.c
index 4ab8e3c..4157816 100644
--- a/testcases/kernel/lib/numa_helper.c
+++ b/testcases/kernel/lib/numa_helper.c
@@ -265,3 +265,27 @@ void nh_dump_nodes()
 	print_node_info(NH_CPUS);
 	print_node_info(NH_MEMS | NH_CPUS);
 }
+
+/*
+ * is_numa - judge a system is NUMA system or not
+ * NOTE: the function is designed to try to find more than
+ *       1 available node, at least each node contains memory.
+ * WARN: Don't use this func in child, as it calls tst_brkm()
+ * RETURNS:
+ *     0 - it's not a NUMA system
+ *     1 - it's a NUMA system
+ */
+int is_numa(void (*cleanup_fn)(void))
+{
+	int ret;
+	int numa_nodes = 0;
+
+	ret = get_allowed_nodes_arr(NH_MEMS, &numa_nodes, NULL);
+	if (ret < 0)
+		tst_brkm(TBROK | TERRNO, cleanup_fn, "get_allowed_nodes_arr");
+
+	if (numa_nodes > 1)
+		return 1;
+	else
+		return 0;
+}
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03
  2013-03-19  3:40     ` [LTP] [PATCH v4 3/7] numa_helper: added a new function is_numa() Zhouping Liu
@ 2013-03-19  3:40       ` Zhouping Liu
  2013-03-19  3:40         ` [LTP] [PATCH v4 5/7] lib/mem: updated testoom() and oom() funcs Zhouping Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

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 | 19 +++++++++++++
 testcases/kernel/mem/oom/oom04.c | 60 +++++++++++++++-------------------------
 3 files changed, 45 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..43ad595 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,10 @@ void cleanup(void)
 
 	TEST_CLEANUP;
 }
+
+#else
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+}
+#endif
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;
 }
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 5/7] lib/mem: updated testoom() and oom() funcs
  2013-03-19  3:40       ` [LTP] [PATCH v4 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03 Zhouping Liu
@ 2013-03-19  3:40         ` Zhouping Liu
  2013-03-19  3:40           ` [LTP] [PATCH v4 6/7] mm/oom05: new testcase Zhouping Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

the 'numa' parameter inside testoom() and 'mempolicy' inside oom()
were useless, so removed them.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/mem/include/mem.h |  4 ++--
 testcases/kernel/mem/lib/mem.c     | 13 +++++--------
 testcases/kernel/mem/oom/oom01.c   |  6 +++---
 testcases/kernel/mem/oom/oom02.c   |  6 +++---
 testcases/kernel/mem/oom/oom03.c   | 10 +++++-----
 testcases/kernel/mem/oom/oom04.c   |  4 ++--
 6 files changed, 20 insertions(+), 23 deletions(-)

diff --git a/testcases/kernel/mem/include/mem.h b/testcases/kernel/mem/include/mem.h
index 1233493..fdf558e 100644
--- a/testcases/kernel/mem/include/mem.h
+++ b/testcases/kernel/mem/include/mem.h
@@ -25,8 +25,8 @@
 #define KSM			4
 
 long overcommit;
-void oom(int testcase, int mempolicy, int lite);
-void testoom(int mempolicy, int lite, int numa);
+void oom(int testcase, int lite);
+void testoom(int mempolicy, int lite);
 
 /* KSM */
 
diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 0b8974c..2c2ab5d 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -61,7 +61,7 @@ static void _test_alloc(int testcase, int lite)
 				return;
 }
 
-void oom(int testcase, int mempolicy, int lite)
+void oom(int testcase, int lite)
 {
 	pid_t pid;
 	int status;
@@ -91,7 +91,7 @@ void oom(int testcase, int mempolicy, int lite)
 	}
 }
 
-void testoom(int mempolicy, int lite, int numa)
+void testoom(int mempolicy, int lite)
 {
 #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
@@ -134,20 +134,17 @@ void testoom(int mempolicy, int lite, int numa)
 	}
 #endif
 
-	if (numa && !mempolicy)
-		write_cpusets(get_a_numa_node(cleanup));
-
 	tst_resm(TINFO, "start normal OOM testing.");
-	oom(NORMAL, mempolicy, lite);
+	oom(NORMAL, lite);
 
 	tst_resm(TINFO, "start OOM testing for mlocked pages.");
-	oom(MLOCK, mempolicy, lite);
+	oom(MLOCK, lite);
 
 	if (access(PATH_KSM, F_OK) == -1)
 		tst_brkm(TCONF, NULL, "KSM configuration is not enabled");
 
 	tst_resm(TINFO, "start OOM testing for KSM pages.");
-	oom(KSM, mempolicy, lite);
+	oom(KSM, lite);
 }
 
 /* KSM */
diff --git a/testcases/kernel/mem/oom/oom01.c b/testcases/kernel/mem/oom/oom01.c
index 0401e31..43a5319 100644
--- a/testcases/kernel/mem/oom/oom01.c
+++ b/testcases/kernel/mem/oom/oom01.c
@@ -61,13 +61,13 @@ int main(int argc, char *argv[])
 		tst_count = 0;
 
 		set_sys_tune("overcommit_memory", 2, 1);
-		oom(OVERCOMMIT, 0, 0);
+		oom(OVERCOMMIT, 0);
 
 		set_sys_tune("overcommit_memory", 0, 1);
-		oom(OVERCOMMIT, 0, 0);
+		oom(OVERCOMMIT, 0);
 
 		set_sys_tune("overcommit_memory", 1, 1);
-		testoom(0, 0, 0);
+		testoom(0, 0);
 	}
 	cleanup();
 	tst_exit();
diff --git a/testcases/kernel/mem/oom/oom02.c b/testcases/kernel/mem/oom/oom02.c
index 3bc8567..1fd199b 100644
--- a/testcases/kernel/mem/oom/oom02.c
+++ b/testcases/kernel/mem/oom/oom02.c
@@ -65,13 +65,13 @@ int main(int argc, char *argv[])
 		tst_count = 0;
 
 		tst_resm(TINFO, "OOM on MPOL_BIND mempolicy...");
-		testoom(MPOL_BIND, 0, 1);
+		testoom(MPOL_BIND, 0);
 
 		tst_resm(TINFO, "OOM on MPOL_INTERLEAVE mempolicy...");
-		testoom(MPOL_INTERLEAVE, 0, 1);
+		testoom(MPOL_INTERLEAVE, 0);
 
 		tst_resm(TINFO, "OOM on MPOL_PREFERRED mempolicy...");
-		testoom(MPOL_PREFERRED, 0, 1);
+		testoom(MPOL_PREFERRED, 0);
 	}
 	cleanup();
 	tst_exit();
diff --git a/testcases/kernel/mem/oom/oom03.c b/testcases/kernel/mem/oom/oom03.c
index 43ad595..124e95f 100644
--- a/testcases/kernel/mem/oom/oom03.c
+++ b/testcases/kernel/mem/oom/oom03.c
@@ -68,7 +68,7 @@ int main(int argc, char *argv[])
 
 		snprintf(mem, BUFSIZ, "%ld", TESTMEM);
 		write_file(MEMCG_PATH_NEW "/memory.limit_in_bytes", mem);
-		testoom(0, 0, 0);
+		testoom(0, 0);
 
 		if (access(MEMCG_SW_LIMIT, F_OK) == -1) {
 			if (errno == ENOENT)
@@ -78,15 +78,15 @@ int main(int argc, char *argv[])
 				tst_brkm(TBROK | TERRNO, cleanup, "access");
 		} else {
 			write_file(MEMCG_SW_LIMIT, mem);
-			testoom(0, 1, 0);
+			testoom(0, 1);
 		}
 
 		/* 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);
+			testoom(MPOL_BIND, 0);
+			testoom(MPOL_INTERLEAVE, 0);
+			testoom(MPOL_PREFERRED, 0);
 		}
 	}
 	cleanup();
diff --git a/testcases/kernel/mem/oom/oom04.c b/testcases/kernel/mem/oom/oom04.c
index 1ad7334..4d3f2f4 100644
--- a/testcases/kernel/mem/oom/oom04.c
+++ b/testcases/kernel/mem/oom/oom04.c
@@ -65,7 +65,7 @@ int main(int argc, char *argv[])
 		tst_count = 0;
 
 		tst_resm(TINFO, "OOM on CPUSET...");
-		testoom(0, 0, 0);
+		testoom(0, 0);
 
 		if (is_numa(cleanup)) {
 			/*
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
 			write_cpuset_files(CPATH_NEW,
 					   "memory_migrate", "1");
 			tst_resm(TINFO, "OOM on CPUSET with mem migrate:");
-			testoom(0, 0, 0);
+			testoom(0, 0);
 		}
 	}
 	cleanup();
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 6/7] mm/oom05: new testcase
  2013-03-19  3:40         ` [LTP] [PATCH v4 5/7] lib/mem: updated testoom() and oom() funcs Zhouping Liu
@ 2013-03-19  3:40           ` Zhouping Liu
  2013-03-19  3:40             ` [LTP] [PATCH v4 7/7] lib/mem: removed the prefix underscore '_' of the internal function name Zhouping Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

added a new case to test OOM under the combination
of MEMCG and CPUSET.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 runtest/mm                       |   1 +
 testcases/kernel/mem/oom/oom05.c | 147 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+)
 create mode 100644 testcases/kernel/mem/oom/oom05.c

diff --git a/runtest/mm b/runtest/mm
index a8bd605..56b83f8 100644
--- a/runtest/mm
+++ b/runtest/mm
@@ -77,6 +77,7 @@ oom01 oom01
 oom02 oom02
 oom03 oom03
 oom04 oom04
+oom05 oom05
 
 swapping01 swapping01 -i 5
 
diff --git a/testcases/kernel/mem/oom/oom05.c b/testcases/kernel/mem/oom/oom05.c
new file mode 100644
index 0000000..cd45f08
--- /dev/null
+++ b/testcases/kernel/mem/oom/oom05.c
@@ -0,0 +1,147 @@
+/*
+ * Out Of Memory (OOM) for MEMCG and CPUSET
+ *
+ * The program is designed to cope with unpredictable like amount and
+ * system physical memory, swap size and other VMM technology like KSM,
+ * memcg, memory hotplug and so on which may affect the OOM
+ * behaviours. It simply increase the memory consumption 3G each time
+ * until all the available memory is consumed and OOM is triggered.
+ *
+ * Copyright (C) 2013  Red Hat, Inc.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * Further, this software is distributed without any warranty that it
+ * is free of the rightful claim of any third person regarding
+ * infringement or the like.  Any license provided herein, whether
+ * implied or otherwise, applies only to this software file.  Patent
+ * licenses, if any, provided herein do not apply to combinations of
+ * this program with other software, or any other product whatsoever.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#include "config.h"
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include "numa_helper.h"
+#include "test.h"
+#include "usctest.h"
+#include "mem.h"
+
+char *TCID = "oom05";
+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 mem[BUFSIZ];
+
+	msg = parse_opts(argc, argv, NULL, NULL);
+	if (msg != NULL)
+		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
+#if __WORDSIZE == 32
+	tst_brkm(TCONF, NULL, "test is not designed for 32-bit system.");
+#endif
+
+	setup();
+
+	for (lc = 0; TEST_LOOPING(lc); lc++) {
+		tst_count = 0;
+
+		tst_resm(TINFO, "OOM on CPUSET & MEMCG...");
+		testoom(0, 0);
+
+		/*
+		 * 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.
+		 */
+		if (is_numa(cleanup)) {
+			write_cpuset_files(CPATH_NEW, "memory_migrate", "1");
+			tst_resm(TINFO, "OOM on CPUSET & MEMCG with "
+					"cpuset.memory_migrate=1");
+			testoom(0, 0);
+		}
+
+		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");
+		}
+
+		if (swap_acc_on) {
+			tst_resm(TINFO, "OOM on CPUSET & MEMCG with "
+					"special memswap limitation:");
+			snprintf(mem, BUFSIZ, "%ld", TESTMEM);
+			write_file(MEMCG_SW_LIMIT, mem);
+			testoom(0, 0);
+
+			tst_resm(TINFO, "OOM on CPUSET & MEMCG with "
+					"disabled memswap limitation:");
+			write_file(MEMCG_SW_LIMIT, "-1");
+			testoom(0, 0);
+		}
+	}
+
+	cleanup();
+	tst_exit();
+}
+
+void setup(void)
+{
+	tst_require_root(NULL);
+	tst_sig(FORK, DEF_HANDLER, cleanup);
+	TEST_PAUSE;
+
+	mount_mem("memcg", "cgroup", "memory", MEMCG_PATH, MEMCG_PATH_NEW);
+	mount_mem("cpuset", "cpuset", NULL, CPATH, CPATH_NEW);
+	write_memcg();
+
+	set_sys_tune("overcommit_memory", 1, 1);
+
+	if (is_numa(cleanup))
+		/* 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);
+
+	overcommit = get_sys_tune("overcommit_memory");
+}
+
+void cleanup(void)
+{
+	set_sys_tune("overcommit_memory", overcommit, 0);
+	umount_mem(CPATH, CPATH_NEW);
+	umount_mem(MEMCG_PATH, MEMCG_PATH_NEW);
+
+	TEST_CLEANUP;
+}
+
+#else /* no NUMA */
+int main(void)
+{
+	tst_brkm(TCONF, NULL, "no NUMA development packages installed.");
+}
+#endif
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [LTP] [PATCH v4 7/7] lib/mem: removed the prefix underscore '_' of the internal function name
  2013-03-19  3:40           ` [LTP] [PATCH v4 6/7] mm/oom05: new testcase Zhouping Liu
@ 2013-03-19  3:40             ` Zhouping Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Zhouping Liu @ 2013-03-19  3:40 UTC (permalink / raw)
  To: LTP List

as chrubis' suggestion, the prefix that start with
_ or __ are reserved for compiler/libc implementation,
inside this patch, I removed all the prefix '_' of
the internal function name.

Signed-off-by: Zhouping Liu <zliu@redhat.com>
---
 testcases/kernel/mem/lib/mem.c | 56 +++++++++++++++++++++---------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index 2c2ab5d..c9525e5 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -27,7 +27,7 @@
 
 /* OOM */
 
-static int _alloc_mem(long int length, int testcase)
+static int alloc_mem(long int length, int testcase)
 {
 	void *s;
 
@@ -51,13 +51,13 @@ static int _alloc_mem(long int length, int testcase)
 	return 0;
 }
 
-static void _test_alloc(int testcase, int lite)
+static void test_alloc(int testcase, int lite)
 {
 	if (lite)
-		_alloc_mem(TESTMEM + MB, testcase);
+		alloc_mem(TESTMEM + MB, testcase);
 	else
 		while (1)
-			if (_alloc_mem(LENGTH, testcase))
+			if (alloc_mem(LENGTH, testcase))
 				return;
 }
 
@@ -70,7 +70,7 @@ void oom(int testcase, int lite)
 	case -1:
 		tst_brkm(TBROK | TERRNO, cleanup, "fork");
 	case 0:
-		_test_alloc(testcase, lite);
+		test_alloc(testcase, lite);
 		exit(0);
 	default:
 		break;
@@ -149,7 +149,7 @@ void testoom(int mempolicy, int lite)
 
 /* KSM */
 
-static void _check(char *path, long int value)
+static void check(char *path, long int value)
 {
 	FILE *fp;
 	char buf[BUFSIZ], fullpath[BUFSIZ];
@@ -164,7 +164,7 @@ static void _check(char *path, long int value)
 		tst_resm(TFAIL, "%s is not %ld.", path, value);
 }
 
-static void _wait_ksmd_done(void)
+static void wait_ksmd_done(void)
 {
 	char buf[BUFSIZ];
 	long pages_shared, pages_sharing, pages_volatile, pages_unshared;
@@ -205,24 +205,24 @@ static void _wait_ksmd_done(void)
 		 count * 10);
 }
 
-static void _group_check(int run, int pages_shared, int pages_sharing,
+static void group_check(int run, int pages_shared, int pages_sharing,
 			 int pages_volatile, int pages_unshared,
 			 int sleep_millisecs, int pages_to_scan)
 {
 	/* wait for ksm daemon to scan all mergeable pages. */
-	_wait_ksmd_done();
+	wait_ksmd_done();
 
 	tst_resm(TINFO, "check!");
-	_check("run", run);
-	_check("pages_shared", pages_shared);
-	_check("pages_sharing", pages_sharing);
-	_check("pages_volatile", pages_volatile);
-	_check("pages_unshared", pages_unshared);
-	_check("sleep_millisecs", sleep_millisecs);
-	_check("pages_to_scan", pages_to_scan);
+	check("run", run);
+	check("pages_shared", pages_shared);
+	check("pages_sharing", pages_sharing);
+	check("pages_volatile", pages_volatile);
+	check("pages_unshared", pages_unshared);
+	check("sleep_millisecs", sleep_millisecs);
+	check("pages_to_scan", pages_to_scan);
 }
 
-static void _verify(char **memory, char value, int proc,
+static void verify(char **memory, char value, int proc,
 		    int start, int end, int start2, int end2)
 {
 	int i, j;
@@ -331,12 +331,12 @@ static void create_ksm_child(int child_num, int size, int unit,
 			tst_brkm(TBROK|TERRNO, tst_exit, "kill");
 
 		if (ksm_merge_data[j].mergeable_size < size * MB) {
-			_verify(memory, 'e', child_num, total_unit - 1,
+			verify(memory, 'e', child_num, total_unit - 1,
 				total_unit, unit * MB - 1, unit * MB);
-			_verify(memory, ksm_merge_data[j].data, child_num,
+			verify(memory, ksm_merge_data[j].data, child_num,
 				0, total_unit, 0, unit * MB - 1);
 		} else {
-			_verify(memory, ksm_merge_data[j].data, child_num,
+			verify(memory, ksm_merge_data[j].data, child_num,
 				0, total_unit, 0, unit * MB);
 		}
 	}
@@ -437,19 +437,19 @@ void create_same_memory(int size, int num, int unit)
 	write_file(PATH_KSM "sleep_millisecs", "0");
 
 	resume_ksm_children(child, num);
-	_group_check(1, 2, size * num * pages - 2, 0, 0, 0, size * pages * num);
+	group_check(1, 2, size * num * pages - 2, 0, 0, 0, size * pages * num);
 
 	stop_ksm_children(child, num);
 	resume_ksm_children(child, num);
-	_group_check(1, 3, size * num * pages - 3, 0, 0, 0, size * pages * num);
+	group_check(1, 3, size * num * pages - 3, 0, 0, 0, size * pages * num);
 
 	stop_ksm_children(child, num);
 	resume_ksm_children(child, num);
-	_group_check(1, 1, size * num * pages - 1, 0, 0, 0, size * pages * num);
+	group_check(1, 1, size * num * pages - 1, 0, 0, 0, size * pages * num);
 
 	stop_ksm_children(child, num);
 	resume_ksm_children(child, num);
-	_group_check(1, 1, size * num * pages - 2, 0, 1, 0, size * pages * num);
+	group_check(1, 1, size * num * pages - 2, 0, 1, 0, size * pages * num);
 
 	stop_ksm_children(child, num);
 
@@ -457,11 +457,11 @@ void create_same_memory(int size, int num, int unit)
 	write_file(PATH_KSM "run", "2");
 
 	resume_ksm_children(child, num);
-	_group_check(2, 0, 0, 0, 0, 0, size * pages * num);
+	group_check(2, 0, 0, 0, 0, 0, size * pages * num);
 
 	tst_resm(TINFO, "stop KSM.");
 	write_file(PATH_KSM "run", "0");
-	_group_check(0, 0, 0, 0, 0, 0, size * pages * num);
+	group_check(0, 0, 0, 0, 0, 0, size * pages * num);
 
 	while (waitpid(-1, &status, WUNTRACED | WCONTINUED) > 0)
 		if (WEXITSTATUS(status) != 0)
@@ -503,7 +503,7 @@ void ksm_usage(void)
 
 /* cpuset/memcg */
 
-static void _gather_node_cpus(char *cpus, long nd)
+static void gather_node_cpus(char *cpus, long nd)
 {
 	int ncpus = 0;
 	int i;
@@ -602,7 +602,7 @@ void write_cpusets(long nd)
 	snprintf(buf, BUFSIZ, "%ld", nd);
 	write_cpuset_files(CPATH_NEW, "mems", buf);
 
-	_gather_node_cpus(cpus, nd);
+	gather_node_cpus(cpus, nd);
 	write_cpuset_files(CPATH_NEW, "cpus", cpus);
 
 	snprintf(buf, BUFSIZ, "%d", getpid());
-- 
1.7.11.7


------------------------------------------------------------------------------
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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM
  2013-03-19  3:40 [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
  2013-03-19  3:40 ` [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
@ 2013-03-20  9:58 ` Wanlong Gao
  2013-03-20 10:25 ` Caspar Zhang
  2013-03-21  0:52 ` Wanlong Gao
  3 siblings, 0 replies; 11+ messages in thread
From: Wanlong Gao @ 2013-03-20  9:58 UTC (permalink / raw)
  To: Zhouping Liu; +Cc: LTP List

On 03/19/2013 11:40 AM, Zhouping Liu wrote:
> changed log from v1 to v2:
>  1. added a new is_numa() function instead of ISNUMA global variable;
>  2. added new patch to remove the prefix underscroe '_' of the
>     internal function name;
>  3. used SAFE_FILE_SCANF() instead of read_file().
>  4. some cleanup...
> 
> changed log from v2 to v3:
>  1. as Jan's suggestion, pass 'nodes=NULL' to get_allowed_nodes_arr()
>     in is_numa(), and free 'nodes' variable when it passed a non-NULL
>     value inside testoom().
> 
> changed log from v3 to v4:
>  1. fixed some patch style error

Sorry, I mean ACK V4.

Acked-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>

> 
> The patch set updated all OOM testcases, and added a new testcase.
> 
> Inside old version, OOM only test MPOL_MBIND mempolicy in NUMA
> system, and the combination of CPUSET, MEMCG & NUMA is complex,
> and not clear. Also CPUSET is only used in NUMA system.
> 
> These patch set adjust them, now we can coverage the below tests:
>  1) OOM under normal - oom01
>  2) OOM under all mempolicy - oom02
>  3) OOM under MEMCG (+ mempolicy) - oom03
>  4) OOM under CPUSET (+ mempolicy)  - oom04
>  5) OOM under CPUSET & MEMCG - oom05
> 
> Zhouping Liu (7):
>   lib/mem: modified _gather_cpus() as _gather_node_cpus()
>   mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy'
>   numa_helper: added a new function is_numa()
>   mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG &
>     numa' to oom03
>   lib/mem: updated testoom() and oom() funcs
>   mm/oom05: new testcase
>   lib/mem: removed the prefix underscore '_' of the internal function
>     name
> 
>  runtest/mm                             |   1 +
>  testcases/kernel/include/numa_helper.h |   1 +
>  testcases/kernel/lib/numa_helper.c     |  24 ++++++
>  testcases/kernel/mem/include/mem.h     |   4 +-
>  testcases/kernel/mem/lib/mem.c         | 147 +++++++++++++++++++++------------
>  testcases/kernel/mem/oom/oom01.c       |   6 +-
>  testcases/kernel/mem/oom/oom02.c       |  20 +++--
>  testcases/kernel/mem/oom/oom03.c       |  23 +++++-
>  testcases/kernel/mem/oom/oom04.c       |  60 ++++++--------
>  testcases/kernel/mem/oom/oom05.c       | 147 +++++++++++++++++++++++++++++++++
>  10 files changed, 328 insertions(+), 105 deletions(-)
>  create mode 100644 testcases/kernel/mem/oom/oom05.c
> 


------------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM
  2013-03-19  3:40 [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
  2013-03-19  3:40 ` [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
  2013-03-20  9:58 ` [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Wanlong Gao
@ 2013-03-20 10:25 ` Caspar Zhang
  2013-03-21  0:52 ` Wanlong Gao
  3 siblings, 0 replies; 11+ messages in thread
From: Caspar Zhang @ 2013-03-20 10:25 UTC (permalink / raw)
  To: Zhouping Liu; +Cc: LTP List

On 03/19/2013 11:40 AM, Zhouping Liu wrote:
> changed log from v1 to v2:
>   1. added a new is_numa() function instead of ISNUMA global variable;
>   2. added new patch to remove the prefix underscroe '_' of the
>      internal function name;
>   3. used SAFE_FILE_SCANF() instead of read_file().
>   4. some cleanup...
>
> changed log from v2 to v3:
>   1. as Jan's suggestion, pass 'nodes=NULL' to get_allowed_nodes_arr()
>      in is_numa(), and free 'nodes' variable when it passed a non-NULL
>      value inside testoom().
>
> changed log from v3 to v4:
>   1. fixed some patch style error
>
> The patch set updated all OOM testcases, and added a new testcase.
>
> Inside old version, OOM only test MPOL_MBIND mempolicy in NUMA
> system, and the combination of CPUSET, MEMCG & NUMA is complex,
> and not clear. Also CPUSET is only used in NUMA system.
>
> These patch set adjust them, now we can coverage the below tests:
>   1) OOM under normal - oom01
>   2) OOM under all mempolicy - oom02
>   3) OOM under MEMCG (+ mempolicy) - oom03
>   4) OOM under CPUSET (+ mempolicy)  - oom04
>   5) OOM under CPUSET & MEMCG - oom05
>
> Zhouping Liu (7):
>    lib/mem: modified _gather_cpus() as _gather_node_cpus()
>    mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy'
>    numa_helper: added a new function is_numa()
>    mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG &
>      numa' to oom03
>    lib/mem: updated testoom() and oom() funcs
>    mm/oom05: new testcase
>    lib/mem: removed the prefix underscore '_' of the internal function
>      name
>
>   runtest/mm                             |   1 +
>   testcases/kernel/include/numa_helper.h |   1 +
>   testcases/kernel/lib/numa_helper.c     |  24 ++++++
>   testcases/kernel/mem/include/mem.h     |   4 +-
>   testcases/kernel/mem/lib/mem.c         | 147 +++++++++++++++++++++------------
>   testcases/kernel/mem/oom/oom01.c       |   6 +-
>   testcases/kernel/mem/oom/oom02.c       |  20 +++--
>   testcases/kernel/mem/oom/oom03.c       |  23 +++++-
>   testcases/kernel/mem/oom/oom04.c       |  60 ++++++--------
>   testcases/kernel/mem/oom/oom05.c       | 147 +++++++++++++++++++++++++++++++++
>   10 files changed, 328 insertions(+), 105 deletions(-)
>   create mode 100644 testcases/kernel/mem/oom/oom05.c
>

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

------------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM
  2013-03-19  3:40 [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
                   ` (2 preceding siblings ...)
  2013-03-20 10:25 ` Caspar Zhang
@ 2013-03-21  0:52 ` Wanlong Gao
  3 siblings, 0 replies; 11+ messages in thread
From: Wanlong Gao @ 2013-03-21  0:52 UTC (permalink / raw)
  To: Zhouping Liu; +Cc: LTP List

On 03/19/2013 11:40 AM, Zhouping Liu wrote:
> changed log from v1 to v2:
>  1. added a new is_numa() function instead of ISNUMA global variable;
>  2. added new patch to remove the prefix underscroe '_' of the
>     internal function name;
>  3. used SAFE_FILE_SCANF() instead of read_file().
>  4. some cleanup...
> 
> changed log from v2 to v3:
>  1. as Jan's suggestion, pass 'nodes=NULL' to get_allowed_nodes_arr()
>     in is_numa(), and free 'nodes' variable when it passed a non-NULL
>     value inside testoom().
> 
> changed log from v3 to v4:
>  1. fixed some patch style error
> 
> The patch set updated all OOM testcases, and added a new testcase.
> 
> Inside old version, OOM only test MPOL_MBIND mempolicy in NUMA
> system, and the combination of CPUSET, MEMCG & NUMA is complex,
> and not clear. Also CPUSET is only used in NUMA system.
> 
> These patch set adjust them, now we can coverage the below tests:
>  1) OOM under normal - oom01
>  2) OOM under all mempolicy - oom02
>  3) OOM under MEMCG (+ mempolicy) - oom03
>  4) OOM under CPUSET (+ mempolicy)  - oom04
>  5) OOM under CPUSET & MEMCG - oom05


Applied, thank you.

Wanlong Gao


------------------------------------------------------------------------------
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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-03-21  0:51 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-19  3:40 [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Zhouping Liu
2013-03-19  3:40 ` [LTP] [PATCH v4 1/7] lib/mem: modified _gather_cpus() as _gather_node_cpus() Zhouping Liu
2013-03-19  3:40   ` [LTP] [PATCH v4 2/7] mm/oom02: modified 'OOM for NUMA' as 'OOM for mempolicy' Zhouping Liu
2013-03-19  3:40     ` [LTP] [PATCH v4 3/7] numa_helper: added a new function is_numa() Zhouping Liu
2013-03-19  3:40       ` [LTP] [PATCH v4 4/7] mm/oom0[3|4]: added 'OOM for CPUSET' and moved 'OOM with MEMCG & numa' to oom03 Zhouping Liu
2013-03-19  3:40         ` [LTP] [PATCH v4 5/7] lib/mem: updated testoom() and oom() funcs Zhouping Liu
2013-03-19  3:40           ` [LTP] [PATCH v4 6/7] mm/oom05: new testcase Zhouping Liu
2013-03-19  3:40             ` [LTP] [PATCH v4 7/7] lib/mem: removed the prefix underscore '_' of the internal function name Zhouping Liu
2013-03-20  9:58 ` [LTP] [PATCH v4 0/7] mm/oom: extend the coverage of OOM Wanlong Gao
2013-03-20 10:25 ` Caspar Zhang
2013-03-21  0:52 ` Wanlong Gao

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.