Skip to contentSkip to conversation

NUMA and follow-up fix

PATCH RESEND In review Caspar Zhang 4 participants 27 messages Aug 9, 2012 – Aug 10, 2012

lore
Share & tools
lore
#0 lore raw

cover NUMA and follow-up fix

Resending the whole patch series (including Jan's 2 patches) for easier reviewing.

updates:
syscalls/numa: check syscall availability
remove TEST() macro and use syscall() directly.
numa_helper: move to libkerntest
merged the library cleaning fix to this one.
mm: use new numa_helper
the same as previous V3 version, which already has Jan's reivew.

Caspar Zhang (4):
syscalls/numa: check syscall availability
numa_helper: move to libkerntest
mm: use new numa_helper
mm: add common Makefile include: libmem.mk

Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes() update testcases to use flag for get_allowed_nodes()

 testcases/kernel/Makefile                          |    4 +
 testcases/kernel/include/lib.mk                    |   37 +++
 testcases/kernel/include/numa_helper.h             |   37 +++
 testcases/kernel/lib/Makefile                      |   29 +++
 testcases/kernel/lib/numa_helper.c                 |  266 ++++++++++++++++++++
 testcases/kernel/mem/cpuset/Makefile               |   22 +--
 testcases/kernel/mem/cpuset/cpuset01.c             |   16 +-
 testcases/kernel/mem/hugetlb/Makefile.inc          |   18 +-
 testcases/kernel/mem/hugetlb/hugemmap/Makefile     |   12 +-
 testcases/kernel/mem/include/libmem.mk             |   40 +++
 testcases/kernel/mem/include/mem.h                 |    2 +-
 testcases/kernel/mem/ksm/Makefile                  |   22 +--
 testcases/kernel/mem/ksm/ksm02.c                   |    9 +-
 testcases/kernel/mem/ksm/ksm04.c                   |    9 +-
 testcases/kernel/mem/lib/Makefile                  |    1 +
 testcases/kernel/mem/lib/mem.c                     |   50 +++--
 testcases/kernel/mem/oom/Makefile                  |   22 +--
 testcases/kernel/mem/oom/oom02.c                   |    4 -
 testcases/kernel/mem/oom/oom04.c                   |    4 -
 testcases/kernel/mem/swapping/Makefile             |   22 +--
 testcases/kernel/mem/thp/Makefile                  |   22 +--
 testcases/kernel/mem/tunable/Makefile              |   22 +--
 testcases/kernel/mem/vma/Makefile                  |    4 +-
 testcases/kernel/mem/vma/vma02.c                   |   19 +-
 testcases/kernel/mem/vma/vma04.c                   |   11 +-
 testcases/kernel/syscalls/get_mempolicy/Makefile   |    2 +-
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   15 +-
 testcases/kernel/syscalls/mbind/Makefile           |    2 +-
 testcases/kernel/syscalls/mbind/mbind01.c          |   14 +-
 testcases/kernel/syscalls/move_pages/Makefile      |    2 +-
 .../kernel/syscalls/move_pages/move_pages02.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages03.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages04.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages05.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages06.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages07.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages08.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages09.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages10.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages11.c      |    5 +-
 .../syscalls/move_pages/move_pages_support.c       |    8 +-
 testcases/kernel/syscalls/numa/Makefile            |   22 --
 testcases/kernel/syscalls/numa/Makefile.inc        |   27 --
 testcases/kernel/syscalls/numa/lib/Makefile        |   26 --
 testcases/kernel/syscalls/numa/lib/numa_helper.c   |  165 ------------
 testcases/kernel/syscalls/numa/lib/numa_helper.h   |   33 ---
 46 files changed, 562 insertions(+), 508 deletions(-)
 create mode 100644 testcases/kernel/include/lib.mk
 create mode 100644 testcases/kernel/include/numa_helper.h
 create mode 100644 testcases/kernel/lib/Makefile
 create mode 100644 testcases/kernel/lib/numa_helper.c
 create mode 100644 testcases/kernel/mem/include/libmem.mk
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
Signature · 1 line
1.7.8.6

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw

PATCH RESEND 1/6 numa_helper: add flag to get_allowed_nodes()

add flag, so testcases can request nodes with available memory/cpus or both.

Also add small debug function.

---
 testcases/kernel/syscalls/numa/lib/numa_helper.c |  211 ++++++++++++++++------
 testcases/kernel/syscalls/numa/lib/numa_helper.h |    8 +-
 2 files changed, 162 insertions(+), 57 deletions(-)
testcases/kernel/syscalls/numa/lib/numa_helper.c +156 -55
index d50cb41..aa98522 100644
@@ -27,6 +27,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include <unistd.h>
 #include <errno.h>
 
@@ -36,26 +37,10 @@
 #include "numa_helper.h"
 #include "linux_syscall_numbers.h"
 
-/*
- * get_allowed_nodes_arr - get number and array of available nodes
- * @num_allowed_nodes: pointer where number of available nodes will be stored
- * @allowed_nodes: array of available node ids, this is MPOL_F_MEMS_ALLOWED
- *                 node bitmask compacted (without holes), so that each field
- *                 contains node number. If NULL only num_allowed_nodes is
- *                 returned, otherwise it cotains new allocated array,
- *                 which caller is responsible to free.
- * RETURNS:
- *     0 on success
- *    -1 on allocation failure
- *    -2 on get_mempolicy failure
- */
-int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes)
-{
 #if HAVE_NUMA_H
-	int i;
-	nodemask_t *allowed_nodemask = NULL;
-	unsigned long max_node;
-
+static unsigned long get_max_node()
+{
+	unsigned long max_node = 0;
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	max_node = NUMA_NUM_NODES;
 	/*
@@ -68,61 +53,150 @@ int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes)
 #else
 	max_node = numa_max_possible_node() + 1;
 #endif
-#endif /* HAVE_NUMA_H */
+	return max_node;
+}
 
-	*num_allowed_nodes = 0;
-	if (allowed_nodes)
-		*allowed_nodes = NULL;
+static void get_nodemask_allnodes(nodemask_t *nodemask,
+	unsigned long max_node)
+{
+	unsigned long nodemask_size = max_node/8+1;
+	int i;
+	char fn[64];
+	struct stat st;
 
-#if HAVE_NUMA_H
-	allowed_nodemask = malloc(max_node/8+1);
-	if (allowed_nodemask == NULL)
-		return -1;
-	nodemask_zero(allowed_nodemask);
-
-	if (allowed_nodes) {
-		*allowed_nodes = malloc(sizeof(int)*max_node);
-		if (*allowed_nodes == NULL) {
-			free(allowed_nodemask);
-			return -1;
-		}
+	memset(nodemask, 0, nodemask_size);
+	for (i = 0; i < max_node; i++) {
+		sprintf(fn, "/sys/devices/system/node/node%d", i);
+		if (stat(fn, &st) == 0)
+			nodemask_set(nodemask, i);
 	}
+}
 
+static int filter_nodemask_mem(nodemask_t *nodemask, unsigned long max_node)
+{
 #if MPOL_F_MEMS_ALLOWED
+	unsigned long nodemask_size = max_node/8+1;
+	memset(nodemask, 0, nodemask_size);
 	/*
 	 * avoid numa_get_mems_allowed(), because of bug in getpol()
 	 * utility function in older versions:
 	 * http://www.spinics.net/lists/linux-numa/msg00849.html
 	 */
-	if (syscall(__NR_get_mempolicy, NULL, allowed_nodemask->n,
-		max_node, 0, MPOL_F_MEMS_ALLOWED) < 0) {
-		free(allowed_nodemask);
-		if (allowed_nodes) {
-			free(*allowed_nodes);
-			*allowed_nodes = NULL;
-		}
+	if (syscall(__NR_get_mempolicy, NULL, nodemask->n,
+		max_node, 0, MPOL_F_MEMS_ALLOWED) < 0)
 		return -2;
-	}
 #else
+	int i;
 	/*
 	 * old libnuma/kernel don't have MPOL_F_MEMS_ALLOWED, so let's assume
 	 * that we can use any node with memory > 0
 	 */
-	for (i = 0; i < max_node; i++)
-		if (numa_node_size64(i, NULL) > 0)
-			nodemask_set(allowed_nodemask, i);
-
+	for (i = 0; i < max_node; i++) {
+		if (!nodemask_isset(nodemask, i))
+			continue;
+		if (numa_node_size64(i, NULL) <= 0)
+			nodemask_clr(nodemask, i);
+	}
 #endif /* MPOL_F_MEMS_ALLOWED */
+	return 0;
+}
+
+static int cpumask_has_cpus(char *cpumask, size_t len)
+{
+	int j;
+	for (j = 0; j < len; j++)
+		if (cpumask[j] == '\0')
+			return 0;
+		else if ((cpumask[j] > '0' && cpumask[j] <= '9') ||
+			(cpumask[j] >= 'a' && cpumask[j] <= 'f'))
+			return 1;
+	return 0;
+
+}
+
+static void filter_nodemask_cpu(nodemask_t *nodemask, unsigned long max_node)
+{
+	char *cpumask = NULL;
+	char fn[64];
+	FILE *f;
+	size_t len;
+	int i, ret;
+
 	for (i = 0; i < max_node; i++) {
-		if (nodemask_isset(allowed_nodemask, i)) {
-			if (allowed_nodes)
-				(*allowed_nodes)[*num_allowed_nodes] = i;
-			(*num_allowed_nodes)++;
+		if (!nodemask_isset(nodemask, i))
+			continue;
+		sprintf(fn, "/sys/devices/system/node/node%d/cpumap", i);
+		f = fopen(fn, "r");
+		if (f) {
+			ret = getdelim(&cpumask, &len, '\n', f);
+			if ((ret > 0) && (!cpumask_has_cpus(cpumask, len)))
+				nodemask_clr(nodemask, i);
+			fclose(f);
 		}
 	}
-	free(allowed_nodemask);
+	free(cpumask);
+}
 #endif /* HAVE_NUMA_H */
-	return 0;
+
+/*
+ * get_allowed_nodes_arr - get number and array of available nodes
+ * @num_nodes: pointer where number of available nodes will be stored
+ * @nodes: array of available node ids, this is MPOL_F_MEMS_ALLOWED
+ *                 node bitmask compacted (without holes), so that each field
+ *                 contains node number. If NULL only num_nodes is
+ *                 returned, otherwise it cotains new allocated array,
+ *                 which caller is responsible to free.
+ * RETURNS:
+ *     0 on success
+ *    -1 on allocation failure
+ *    -2 on get_mempolicy failure
+ */
+int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes)
+{
+	int ret = 0;
+#if HAVE_NUMA_H
+	int i;
+	nodemask_t *nodemask = NULL;
+#endif
+	*num_nodes = 0;
+	if (nodes)
+		*nodes = NULL;
+
+#if HAVE_NUMA_H
+	unsigned long max_node = get_max_node();
+	unsigned long nodemask_size = max_node/8+1;
+
+	nodemask = malloc(nodemask_size);
+	if (nodes)
+		*nodes = malloc(sizeof(int)*max_node);
+
+	do {
+		if (nodemask == NULL ||	(nodes && (*nodes == NULL))) {
+			ret = -1;
+			break;
+		}
+
+		/* allow all nodes at start, then filter based on flags */
+		get_nodemask_allnodes(nodemask, max_node);
+		if ((flag & NH_MEMS) == NH_MEMS) {
+			ret = filter_nodemask_mem(nodemask, max_node);
+			if (ret < 0)
+				break;
+		}
+		if ((flag & NH_CPUS) == NH_CPUS)
+			filter_nodemask_cpu(nodemask, max_node);
+
+		for (i = 0; i <	max_node; i++) {
+			if (nodemask_isset(nodemask, i)) {
+				if (nodes)
+					(*nodes)[*num_nodes] = i;
+				(*num_nodes)++;
+			}
+		}
+	} while (0);
+	free(nodemask);
+#endif
+	return ret;
 }
 
 /*
@@ -135,7 +209,7 @@ int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes)
  *    -2 on get_mempolicy failure
  *    -3 on not enough allowed nodes
  */
-int get_allowed_nodes(int count, ...)
+int get_allowed_nodes(int flag, int count, ...)
 {
 	int ret;
 	int i, *nodep;
@@ -143,7 +217,7 @@ int get_allowed_nodes(int count, ...)
 	int num_nodes = 0;
 	int *nodes = NULL;
 
-	ret = get_allowed_nodes_arr(&num_nodes, &nodes);
+	ret = get_allowed_nodes_arr(flag, &num_nodes, &nodes);
 	if (ret < 0)
 		return ret;
 
@@ -163,3 +237,30 @@ int get_allowed_nodes(int count, ...)
 
 	return ret;
 }
+
+static void print_node_info(int flag)
+{
+	int *allowed_nodes = NULL;
+	int i, ret, num_nodes;
+
+	ret = get_allowed_nodes_arr(flag, &num_nodes, &allowed_nodes);
+	printf("nodes (flag=%d): ", flag);
+	if (ret == 0) {
+		for (i = 0; i < num_nodes; i++)
+			printf("%d ", allowed_nodes[i]);
+		printf("\n");
+	} else
+		printf("error(%d)\n", ret);
+	free(allowed_nodes);
+}
+
+/*
+ * nh_dump_nodes - dump info about nodes to stdout
+ */
+void nh_dump_nodes()
+{
+	print_node_info(0);
+	print_node_info(NH_MEMS);
+	print_node_info(NH_CPUS);
+	print_node_info(NH_MEMS | NH_CPUS);
+}
testcases/kernel/syscalls/numa/lib/numa_helper.h +6 -2
index 6bfc58e..463019a 100644
@@ -27,7 +27,11 @@
 #include <numaif.h>
 #endif
 
-int get_allowed_nodes_arr(int *num_allowed_nodes, int **allowed_nodes);
-int get_allowed_nodes(int count, ...);
+#define NH_MEMS (1 << 0)
+#define NH_CPUS (1 << 1)
+
+int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
+int get_allowed_nodes(int flag, int count, ...);
+void nh_dump_nodes();
 
 #endif

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reviewed-by on v1 1/6
#2 lore raw

Re: [LTP] [PATCH resend 1/6] numa_helper: add flag to get_allowed_nodes()

Quoted 6 lines · Caspar Zhang

add flag, so testcases can request nodes with available memory/cpus or both.

Also add small debug function.

nice code, simple & clear :)

Thanks,
Zhouping

Quoted 15 lines
---
  testcases/kernel/syscalls/numa/lib/numa_helper.c |  211 ++++++++++++++++------
  testcases/kernel/syscalls/numa/lib/numa_helper.h |    8 +-
  2 files changed, 162 insertions(+), 57 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw

PATCH RESEND 2/6 update testcases to use flag for get_allowed_nodes()

In reply to Caspar Zhang

Interface of get_allowed_nodes() now requires a flag, update all testcases using this interface.

Also fix some checkpatch warnings.

---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |    5 +++--
 testcases/kernel/syscalls/mbind/mbind01.c          |    5 +++--
 .../kernel/syscalls/move_pages/move_pages02.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages03.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages04.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages05.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages06.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages07.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages08.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages09.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages10.c      |    5 +++--
 .../kernel/syscalls/move_pages/move_pages11.c      |    5 +++--
 .../syscalls/move_pages/move_pages_support.c       |    8 +++++---
 13 files changed, 41 insertions(+), 27 deletions(-)
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +3 -2
index 9011980..d0e372c 100644
@@ -234,8 +234,9 @@ static int do_test(struct test_case *tc)
 	unsigned long len = MEM_LENGTH;
 	int test_node = -1;
 
-	if ((ret = get_allowed_nodes(1, &test_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 1, &test_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	nodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(nodemask);
testcases/kernel/syscalls/mbind/mbind01.c +3 -2
index 1148324..2fc6f5a 100644
@@ -220,8 +220,9 @@ static int do_test(struct test_case *tc)
 	unsigned long *invalid_nodemask;
 	int test_node = -1;
 
-	if ((ret = get_allowed_nodes(1, &test_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 1, &test_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	nodemask = malloc(sizeof(nodemask_t));
testcases/kernel/syscalls/move_pages/move_pages02.c +3 -2
index 410e368..903de0c 100644
@@ -87,8 +87,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages03.c +3 -2
index 77de94d..b216803 100644
@@ -126,8 +126,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages04.c +3 -2
index acb4c78..5a09943 100644
@@ -93,8 +93,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret	< 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages05.c +3 -2
index d2db475..fca97c3 100644
@@ -127,8 +127,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages06.c +3 -2
index 6929f8d..e414e4a 100644
@@ -87,8 +87,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(1, &from_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 1, &from_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages07.c +3 -2
index 4a1f96a..0027af6 100644
@@ -87,8 +87,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages08.c +3 -2
index 9b36a00..cd84d70 100644
@@ -85,8 +85,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages09.c +3 -2
index 8190a26..0d30a9e 100644
@@ -84,8 +84,9 @@ int main(int argc, char **argv)
 	unsigned int from_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(1, &from_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 1, &from_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages10.c +3 -2
index cec114c..7ea3900 100644
@@ -87,8 +87,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages11.c +3 -2
index 3d82c6f..96006cc 100644
@@ -126,8 +126,9 @@ int main(int argc, char **argv)
 	unsigned int to_node;
 	int ret;
 
-	if ((ret = get_allowed_nodes(2, &from_node, &to_node)) < 0)
-		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes(): %d", ret);
+	ret = get_allowed_nodes(NH_MEMS, 2, &from_node, &to_node);
+	if (ret < 0)
+		tst_brkm(TBROK|TERRNO, cleanup, "get_allowed_nodes: %d", ret);
 
 	/* check for looping state if -i option is given */
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/syscalls/move_pages/move_pages_support.c +5 -3
index f7e3995..5a869ec 100644
@@ -120,7 +120,8 @@ int alloc_pages_linear(void **pages, unsigned int num)
 	int *allowed_nodes;
 	int ret;
 
-	ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes);
+	ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes,
+		&allowed_nodes);
 	if (ret < 0)
 		tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
 
@@ -223,7 +224,8 @@ void verify_pages_linear(void **pages, int *status, unsigned int num)
 	int *allowed_nodes;
 	int ret;
 
-	ret = get_allowed_nodes_arr(&num_allowed_nodes, &allowed_nodes);
+	ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes,
+		&allowed_nodes);
 	if (ret < 0)
 		tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
 
@@ -396,7 +398,7 @@ void check_config(unsigned int min_nodes)
 	int num_allowed_nodes;
 	int ret;
 
-	ret = get_allowed_nodes_arr(&num_allowed_nodes, NULL);
+	ret = get_allowed_nodes_arr(NH_MEMS, &num_allowed_nodes, NULL);
 	if (ret < 0)
 		tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes(): %d", ret);
 

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reviewed-by on v1 2/6
#4 lore raw

Re: [LTP] [PATCH resend 2/6] update testcases to use flag for get_allowed_nodes()

Quoted 6 lines · Caspar Zhang

Interface of get_allowed_nodes() now requires a flag, update all testcases using this interface.

Also fix some checkpatch warnings.

Looks good for me.

Thanks,
Zhouping

Quoted 26 lines
---
  .../syscalls/get_mempolicy/get_mempolicy01.c       |    5 +++--
  testcases/kernel/syscalls/mbind/mbind01.c          |    5 +++--
  .../kernel/syscalls/move_pages/move_pages02.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages03.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages04.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages05.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages06.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages07.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages08.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages09.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages10.c      |    5 +++--
  .../kernel/syscalls/move_pages/move_pages11.c      |    5 +++--
  .../syscalls/move_pages/move_pages_support.c       |    8 +++++---
  13 files changed, 41 insertions(+), 27 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#5 lore raw

PATCH RESEND 3/6 syscalls/numa: check syscall availability

In reply to Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in setup() function, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch

---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
 testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +10 -0
index d0e372c..f321172 100644
@@ -339,6 +339,16 @@ static void cleanup(void)
 
 static void setup(void)
 {
+	/* check syscall availability */
+	if (syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0) == -1) {
+		if (errno == ENOSYS)
+			tst_brkm(TCONF, NULL, "syscall __NR_get_mempolicy "
+				    "not supported on your arch.");
+		else
+			tst_brkm(TBROK|TERRNO, NULL,
+				    "syscall __NR_get_mempolicy");
+	}
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }
testcases/kernel/syscalls/mbind/mbind01.c +9 -0
index 2fc6f5a..714dbf7 100644
@@ -300,6 +300,15 @@ TEST_END:
 
 static void setup(void)
 {
+	/* check syscall availability */
+	if (syscall(__NR_mbind, NULL, 0, 0, NULL, 0, 0) == -1) {
+		if (errno == ENOSYS)
+			tst_brkm(TCONF, NULL, "syscall __NR_mbind "
+				    "not supported on your arch.");
+		else
+			tst_brkm(TBROK|TERRNO, NULL, "syscall __NR_mbind");
+	}
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#6 lore raw

Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

Caspar,

I think what Garrett meant was something like this:
/* check if syscall is supported, syscall() here is macro from linux_syscall_numbers.h */ syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0);

linux_syscall_numbers.h defines a macro "syscall", which checks for ENOSYS.

Regards,
Jan

----- Original Message -----

Quoted 22 lines

From: "Caspar Zhang" <[email protected]>
To: "LTP List" <[email protected]>
Sent: Thursday, 9 August, 2012 8:15:39 AM
Subject: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in
setup() function, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not
supported on your arch

---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
 testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)
Quoted 13 lines

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#7 lore raw

Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

Quoted 7 lines · Jan Stancek

Caspar,

I think what Garrett meant was something like this:
/* check if syscall is supported, syscall() here is macro from linux_syscall_numbers.h */ syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0);

linux_syscall_numbers.h defines a macro "syscall", which checks for ENOSYS.

You're right, hope my "resend v2" is the final correct version...

Oops, the patch didn't append after this mail but followed to the top thread... hmmm, please help to review the one tagged as "PATCH resend v2 3/6".

And thank you very much for your testing on the whole patch series!

Thanks,
Caspar

Quoted 40 lines

Regards,
Jan

----- Original Message -----

Quoted 35 lines

From: "Caspar Zhang" <[email protected]>
To: "LTP List" <[email protected]>
Sent: Thursday, 9 August, 2012 8:15:39 AM
Subject: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in
setup() function, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not
supported on your arch

---
  .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
  testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
  2 files changed, 19 insertions(+), 0 deletions(-)

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reviewed-by on v1 3/6
#8 lore raw

Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

In reply to Caspar Zhang
Quoted 8 lines · Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in setup() function, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch

Thanks,
Zhouping

Quoted 15 lines
---
  .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
  testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
  2 files changed, 19 insertions(+), 0 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#9 lore raw

Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

Quoted 11 lines · Zhouping Liu
Quoted 8 lines · Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in setup() function, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch

Zhouping, 3/6 already has a V2 version.

Thanks,
Wanlong Gao

Quoted 35 lines

Thanks,
Zhouping

Quoted 15 lines
---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   10 ++++++++++
 testcases/kernel/syscalls/mbind/mbind01.c          |    9 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

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

Quoted 5 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#10 lore raw

Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

----- Original Message -----

Quoted 16 lines

From: "Wanlong Gao" <[email protected]>
To: "Zhouping Liu" <[email protected]>
Cc: "Caspar Zhang" <[email protected]>, "LTP List" <[email protected]>
Sent: Friday, August 10, 2012 3:54:57 PM
Subject: Re: [LTP] [PATCH resend 3/6] syscalls/numa: check syscall availability

Quoted 9 lines · Zhouping Liu
Quoted 8 lines · Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on
some arches (e.g. i386), this patch checks the syscalls' availability in
setup() function, if the syscall is not implemented on the system, a
TCONF message will be given like this:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not
supported on your arch

Zhouping, 3/6 already has a V2 version.

yeah, sorry, I replied on a bad place. :(
thanks for your reminder :)

Thanks,
Zhouping

Quoted 52 lines

Thanks,
Wanlong Gao

Quoted 46 lines

Thanks,
Zhouping

Quoted 19 lines
---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   10
 ++++++++++
 testcases/kernel/syscalls/mbind/mbind01.c          |    9
 +++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Signature · 13 lines
Thanks,
Zhouping

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#11 lore raw

PATCH RESEND 4/6 numa_helper: move to libkerntest

In reply to Caspar Zhang

libnuma_helper could be used by testcases both under syscalls/ and mem/, it's better to add a new common lib in their parent dir, so I created libkerntest under testcases/kernel/lib/, and put numa_helper to it. In the future, we can add more APIs to it.

---
 testcases/kernel/Makefile                        |    4 +
 testcases/kernel/include/lib.mk                  |   37 +++
 testcases/kernel/include/numa_helper.h           |   37 +++
 testcases/kernel/lib/Makefile                    |   29 +++
 testcases/kernel/lib/numa_helper.c               |  266 ++++++++++++++++++++++
 testcases/kernel/syscalls/get_mempolicy/Makefile |    2 +-
 testcases/kernel/syscalls/mbind/Makefile         |    2 +-
 testcases/kernel/syscalls/move_pages/Makefile    |    2 +-
 testcases/kernel/syscalls/numa/Makefile          |   22 --
 testcases/kernel/syscalls/numa/Makefile.inc      |   27 ---
 testcases/kernel/syscalls/numa/lib/Makefile      |   26 --
 testcases/kernel/syscalls/numa/lib/numa_helper.c |  266 ----------------------
 testcases/kernel/syscalls/numa/lib/numa_helper.h |   37 ---
 13 files changed, 376 insertions(+), 381 deletions(-)
 create mode 100644 testcases/kernel/include/lib.mk
 create mode 100644 testcases/kernel/include/numa_helper.h
 create mode 100644 testcases/kernel/lib/Makefile
 create mode 100644 testcases/kernel/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
testcases/kernel/Makefile +4 -0
index 3922ce1..4b4800d 100644
@@ -29,6 +29,10 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 # Build syscalls in all scenarios.
 SUBDIRS			:= syscalls
+
+# Build lib
+SUBDIRS			+= lib
+
 ifneq ($(UCLINUX),1)
 # KEEP THIS LIST ALPHABETIZED PLEASE!
 SUBDIRS			+= connectors \
testcases/kernel/include/lib.mk new file +37 -0
new file mode 100644
index 0000000..624134b
@@ -0,0 +1,37 @@
+#
+#  Copyright (C) 2012 Linux Test Project, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+KERNEL_DIR		:= $(top_srcdir)/testcases/kernel
+LIBKERNTEST_DIR		:= $(KERNEL_DIR)/lib
+LIBKERNTEST		:= $(KERNEL_DIR)/libkerntest.a
+CPPFLAGS		+= $(NUMA_CPPFLAGS) -I$(KERNEL_DIR)/include
+LDLIBS			+= $(NUMA_LIBS) -lkerntest -lltp
+LDFLAGS			+= -L$(LIBKERNTEST_DIR)
+
+$(LIBKERNTEST_DIR):
+	mkdir -p "$@"
+
+$(LIBKERNTEST): $(LIBKERNTEST_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS		+= $(LIBKERNTEST)
+
+trunk-clean:: | lib-clean
+
+lib-clean:: $(LIBKERNTEST_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
testcases/kernel/include/numa_helper.h new file +37 -0
new file mode 100644
index 0000000..463019a
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Linux Test Project, Inc.
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef NUMA_HELPER_H
+#define NUMA_HELPER_H
+
+#include "config.h"
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
+#include <numaif.h>
+#endif
+
+#define NH_MEMS (1 << 0)
+#define NH_CPUS (1 << 1)
+
+int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
+int get_allowed_nodes(int flag, int count, ...);
+void nh_dump_nodes();
+
+#endif
testcases/kernel/lib/Makefile new file +29 -0
new file mode 100644
index 0000000..847f6af
@@ -0,0 +1,29 @@
+#
+#    kernel/lib Makefile.
+#
+#    Copyright (C) 2012, Linux Test Project.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir		?= ../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+CPPFLAGS		+= $(NUMA_CPPFLAGS) -I../include
+LIB			:= libkerntest.a
+
+include $(top_srcdir)/include/mk/lib.mk
+include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/lib/numa_helper.c new file +266 -0

266 lines not on this page · raw message

testcases/kernel/syscalls/get_mempolicy/Makefile +1 -1
index 333ad21..fb7e9ac 100644
@@ -22,5 +22,5 @@ include $(top_srcdir)/include/mk/testcases.mk
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mbind/Makefile +1 -1
index 932037f..5132dff 100644
@@ -31,5 +31,5 @@ endif
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/move_pages/Makefile +1 -1
index cf2b83f..d4620e1 100644
@@ -35,5 +35,5 @@ $(MAKE_TARGETS): %: %.o move_pages_support.o
 
 LDLIBS			+= -lpthread -lrt
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/numa/Makefile deleted +0 -22
deleted file mode 100644
index b38c5b2..0000000
@@ -1,22 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/numa/Makefile.inc deleted +0 -27
deleted file mode 100644
index 59c2f9e..0000000
@@ -1,27 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-CPPFLAGS		+= $(NUMA_CPPFLAGS) -I../numa/lib/
-LIBDIR			:= ../numa/lib
-LIB			:= $(LIBDIR)/libnuma_helper.a
-MAKE_DEPS		+= $(LIB)
-LDLIBS			+= $(NUMA_LIBS) -lnuma_helper -lltp
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIB): $(LIBDIR)
-		$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
testcases/kernel/syscalls/numa/lib/Makefile deleted +0 -26
deleted file mode 100644
index ba2fb48..0000000
@@ -1,26 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-CPPFLAGS		+= -I../../../include $(NUMA_CPPFLAGS)
-LIB			:= libnuma_helper.a
-
-include $(top_srcdir)/include/mk/lib.mk
testcases/kernel/syscalls/numa/lib/numa_helper.c deleted +0 -266

266 lines not on this page · raw message

testcases/kernel/syscalls/numa/lib/numa_helper.h deleted +0 -37
deleted file mode 100644
index 463019a..0000000
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Linux Test Project, Inc.
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY;  without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef NUMA_HELPER_H
-#define NUMA_HELPER_H
-
-#include "config.h"
-#if HAVE_NUMA_H
-#include <numa.h>
-#endif
-#if HAVE_NUMAIF_H
-#include <numaif.h>
-#endif
-
-#define NH_MEMS (1 << 0)
-#define NH_CPUS (1 << 1)
-
-int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
-int get_allowed_nodes(int flag, int count, ...);
-void nh_dump_nodes();
-
-#endif

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#12 lore raw

PATCH RESEND v2 4/6 numa_helper: move to libkerntest

libnuma_helper could be used by testcases both under syscalls/ and mem/, it's better to add a new common lib in their parent dir, so I created libkerntest under testcases/kernel/lib/, and put numa_helper to it. In the future, we can add more APIs to it.

---
 testcases/kernel/Makefile                        |    4 +
 testcases/kernel/include/lib.mk                  |   37 +++
 testcases/kernel/include/numa_helper.h           |   37 +++
 testcases/kernel/lib/Makefile                    |   28 +++
 testcases/kernel/lib/numa_helper.c               |  266 ++++++++++++++++++++++
 testcases/kernel/syscalls/get_mempolicy/Makefile |    2 +-
 testcases/kernel/syscalls/mbind/Makefile         |    2 +-
 testcases/kernel/syscalls/move_pages/Makefile    |    2 +-
 testcases/kernel/syscalls/numa/Makefile          |   22 --
 testcases/kernel/syscalls/numa/Makefile.inc      |   27 ---
 testcases/kernel/syscalls/numa/lib/Makefile      |   26 --
 testcases/kernel/syscalls/numa/lib/numa_helper.c |  266 ----------------------
 testcases/kernel/syscalls/numa/lib/numa_helper.h |   37 ---
 13 files changed, 375 insertions(+), 381 deletions(-)
 create mode 100644 testcases/kernel/include/lib.mk
 create mode 100644 testcases/kernel/include/numa_helper.h
 create mode 100644 testcases/kernel/lib/Makefile
 create mode 100644 testcases/kernel/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h
testcases/kernel/Makefile +4 -0
index 3922ce1..4b4800d 100644
@@ -29,6 +29,10 @@ include $(top_srcdir)/include/mk/env_pre.mk
 
 # Build syscalls in all scenarios.
 SUBDIRS			:= syscalls
+
+# Build lib
+SUBDIRS			+= lib
+
 ifneq ($(UCLINUX),1)
 # KEEP THIS LIST ALPHABETIZED PLEASE!
 SUBDIRS			+= connectors \
testcases/kernel/include/lib.mk new file +37 -0
new file mode 100644
index 0000000..624134b
@@ -0,0 +1,37 @@
+#
+#  Copyright (C) 2012 Linux Test Project, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+#
+
+KERNEL_DIR		:= $(top_srcdir)/testcases/kernel
+LIBKERNTEST_DIR		:= $(KERNEL_DIR)/lib
+LIBKERNTEST		:= $(KERNEL_DIR)/libkerntest.a
+CPPFLAGS		+= $(NUMA_CPPFLAGS) -I$(KERNEL_DIR)/include
+LDLIBS			+= $(NUMA_LIBS) -lkerntest -lltp
+LDFLAGS			+= -L$(LIBKERNTEST_DIR)
+
+$(LIBKERNTEST_DIR):
+	mkdir -p "$@"
+
+$(LIBKERNTEST): $(LIBKERNTEST_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS		+= $(LIBKERNTEST)
+
+trunk-clean:: | lib-clean
+
+lib-clean:: $(LIBKERNTEST_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
testcases/kernel/include/numa_helper.h new file +37 -0
new file mode 100644
index 0000000..463019a
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2012 Linux Test Project, Inc.
+ *
+ * This program is free software;  you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY;  without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+ * the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program;  if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef NUMA_HELPER_H
+#define NUMA_HELPER_H
+
+#include "config.h"
+#if HAVE_NUMA_H
+#include <numa.h>
+#endif
+#if HAVE_NUMAIF_H
+#include <numaif.h>
+#endif
+
+#define NH_MEMS (1 << 0)
+#define NH_CPUS (1 << 1)
+
+int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
+int get_allowed_nodes(int flag, int count, ...);
+void nh_dump_nodes();
+
+#endif
testcases/kernel/lib/Makefile new file +28 -0
new file mode 100644
index 0000000..f41af8f
@@ -0,0 +1,28 @@
+#
+#    kernel/lib Makefile.
+#
+#    Copyright (C) 2012, Linux Test Project.
+#
+#    This program is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 2 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with this program; if not, write to the Free Software Foundation, Inc.,
+#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+
+top_srcdir		?= ../../..
+
+include $(top_srcdir)/include/mk/env_pre.mk
+
+CPPFLAGS		+= $(NUMA_CPPFLAGS) -I../include
+LIB			:= libkerntest.a
+
+include $(top_srcdir)/include/mk/lib.mk
testcases/kernel/lib/numa_helper.c new file +266 -0

266 lines not on this page · raw message

testcases/kernel/syscalls/get_mempolicy/Makefile +1 -1
index 333ad21..fb7e9ac 100644
@@ -22,5 +22,5 @@ include $(top_srcdir)/include/mk/testcases.mk
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mbind/Makefile +1 -1
index 932037f..5132dff 100644
@@ -31,5 +31,5 @@ endif
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/move_pages/Makefile +1 -1
index cf2b83f..d4620e1 100644
@@ -35,5 +35,5 @@ $(MAKE_TARGETS): %: %.o move_pages_support.o
 
 LDLIBS			+= -lpthread -lrt
 
-include $(abs_srcdir)/../numa/Makefile.inc
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/numa/Makefile deleted +0 -22
deleted file mode 100644
index b38c5b2..0000000
@@ -1,22 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/kernel/syscalls/numa/Makefile.inc deleted +0 -27
deleted file mode 100644
index 59c2f9e..0000000
@@ -1,27 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-CPPFLAGS		+= $(NUMA_CPPFLAGS) -I../numa/lib/
-LIBDIR			:= ../numa/lib
-LIB			:= $(LIBDIR)/libnuma_helper.a
-MAKE_DEPS		+= $(LIB)
-LDLIBS			+= $(NUMA_LIBS) -lnuma_helper -lltp
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIB): $(LIBDIR)
-		$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
testcases/kernel/syscalls/numa/lib/Makefile deleted +0 -26
deleted file mode 100644
index ba2fb48..0000000
@@ -1,26 +0,0 @@
-#
-#  Copyright (C) 2012 Linux Test Project, Inc.
-#
-#  This program is free software;  you can redistribute it and/or modify
-#  it under the terms of the GNU General Public License as published by
-#  the Free Software Foundation; either version 2 of the License, or
-#  (at your option) any later version.
-#
-#  This program is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
-#  the GNU General Public License for more details.
-#
-#  You should have received a copy of the GNU General Public License
-#  along with this program;  if not, write to the Free Software
-#  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-#
-
-top_srcdir		?= ../../../../..
-
-include $(top_srcdir)/include/mk/env_pre.mk
-
-CPPFLAGS		+= -I../../../include $(NUMA_CPPFLAGS)
-LIB			:= libnuma_helper.a
-
-include $(top_srcdir)/include/mk/lib.mk
testcases/kernel/syscalls/numa/lib/numa_helper.c deleted +0 -266

266 lines not on this page · raw message

testcases/kernel/syscalls/numa/lib/numa_helper.h deleted +0 -37
deleted file mode 100644
index 463019a..0000000
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 Linux Test Project, Inc.
- *
- * This program is free software;  you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY;  without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
- * the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program;  if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- */
-
-#ifndef NUMA_HELPER_H
-#define NUMA_HELPER_H
-
-#include "config.h"
-#if HAVE_NUMA_H
-#include <numa.h>
-#endif
-#if HAVE_NUMAIF_H
-#include <numaif.h>
-#endif
-
-#define NH_MEMS (1 << 0)
-#define NH_CPUS (1 << 1)
-
-int get_allowed_nodes_arr(int flag, int *num_nodes, int **nodes);
-int get_allowed_nodes(int flag, int count, ...);
-void nh_dump_nodes();
-
-#endif

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Tested-by on v2 4/6
#13 lore raw

Re: [LTP] [PATCH resend 4/6 v2] numa_helper: move to libkerntest

Quoted 6 lines · Caspar Zhang

libnuma_helper could be used by testcases both under syscalls/ and mem/, it's better to add a new common lib in their parent dir, so I created libkerntest under testcases/kernel/lib/, and put numa_helper to it. In the future, we can add more APIs to it.

tested on two machines with 2 & 8 nodes, and offline all cpus in one nodes, not found any issues.

Thanks,
Zhouping

Quoted 35 lines
---
  testcases/kernel/Makefile                        |    4 +
  testcases/kernel/include/lib.mk                  |   37 +++
  testcases/kernel/include/numa_helper.h           |   37 +++
  testcases/kernel/lib/Makefile                    |   28 +++
  testcases/kernel/lib/numa_helper.c               |  266 ++++++++++++++++++++++
  testcases/kernel/syscalls/get_mempolicy/Makefile |    2 +-
  testcases/kernel/syscalls/mbind/Makefile         |    2 +-
  testcases/kernel/syscalls/move_pages/Makefile    |    2 +-
  testcases/kernel/syscalls/numa/Makefile          |   22 --
  testcases/kernel/syscalls/numa/Makefile.inc      |   27 ---
  testcases/kernel/syscalls/numa/lib/Makefile      |   26 --
  testcases/kernel/syscalls/numa/lib/numa_helper.c |  266 ----------------------
  testcases/kernel/syscalls/numa/lib/numa_helper.h |   37 ---
  13 files changed, 375 insertions(+), 381 deletions(-)

create mode 100644 testcases/kernel/include/lib.mk create mode 100644 testcases/kernel/include/numa_helper.h create mode 100644 testcases/kernel/lib/Makefile
create mode 100644 testcases/kernel/lib/numa_helper.c delete mode 100644 testcases/kernel/syscalls/numa/Makefile delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#14 lore raw

PATCH RESEND 5/6 mm: use new numa_helper

In reply to Caspar Zhang

This patch makes the tests in mem/ dir use numa_helper in libkerntest.

---
 testcases/kernel/mem/cpuset/Makefile           |    1 +
 testcases/kernel/mem/cpuset/cpuset01.c         |   16 ++++----
 testcases/kernel/mem/hugetlb/Makefile.inc      |    1 +
 testcases/kernel/mem/hugetlb/hugemmap/Makefile |    1 +
 testcases/kernel/mem/include/mem.h             |    2 +-
 testcases/kernel/mem/ksm/Makefile              |    1 +
 testcases/kernel/mem/ksm/ksm02.c               |    9 ++--
 testcases/kernel/mem/ksm/ksm04.c               |    9 ++--
 testcases/kernel/mem/lib/Makefile              |    1 +
 testcases/kernel/mem/lib/mem.c                 |   50 ++++++++++++++++--------
 testcases/kernel/mem/oom/Makefile              |    1 +
 testcases/kernel/mem/oom/oom02.c               |    4 --
 testcases/kernel/mem/oom/oom04.c               |    4 --
 testcases/kernel/mem/swapping/Makefile         |    1 +
 testcases/kernel/mem/thp/Makefile              |    1 +
 testcases/kernel/mem/tunable/Makefile          |    1 +
 testcases/kernel/mem/vma/Makefile              |    3 +-
 testcases/kernel/mem/vma/vma02.c               |   19 ++++++---
 testcases/kernel/mem/vma/vma04.c               |   11 ++++-
 19 files changed, 81 insertions(+), 55 deletions(-)
testcases/kernel/mem/cpuset/Makefile +1 -0
index f0c34ba..c9d03bf 100644
@@ -41,4 +41,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/cpuset/cpuset01.c +8 -8
index b20485f..2be6953 100644
@@ -51,6 +51,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "mem.h"
+#include "numa_helper.h"
 
 char *TCID = "cpuset01";
 int TST_TOTAL = 1;
@@ -58,8 +59,8 @@ int TST_TOTAL = 1;
 #if HAVE_NUMA_H && HAVE_LINUX_MEMPOLICY_H && HAVE_NUMAIF_H \
 	&& HAVE_MPOL_CONSTANTS
 volatile int end;
-static long nodes[MAXNODES];
-static long nnodes;
+static int *nodes;
+static int nnodes;
 static long ncpus;
 
 static void testcpuset(void);
@@ -77,11 +78,10 @@ int main(int argc, char *argv[])
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
 
 	ncpus = count_cpu();
-	nnodes = count_numa(nodes);
-	tst_resm(TINFO, "The system has %ld CPUs, %ld NUMA nodes",
-			ncpus, nnodes);
+	if (get_allowed_nodes_arr(NH_MEMS|NH_CPUS, &nnodes, &nodes) < 0)
+		tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes_arr");
 	if (nnodes <= 1)
-		tst_brkm(TCONF, NULL, "required a NUMA system.");
+		tst_brkm(TCONF, NULL, "requires a NUMA system.");
 
 	setup();
 	testcpuset();
@@ -115,9 +115,9 @@ static void testcpuset(void)
 	}
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		Tst_count = 0;
-		snprintf(buf, BUFSIZ, "%ld", nodes[0]);
+		snprintf(buf, BUFSIZ, "%d", nodes[0]);
 		write_cpuset_files(CPATH_NEW, "mems", buf);
-		snprintf(buf, BUFSIZ, "%ld", nodes[1]);
+		snprintf(buf, BUFSIZ, "%d", nodes[1]);
 		write_cpuset_files(CPATH_NEW, "mems", buf);
 	}
 
testcases/kernel/mem/hugetlb/Makefile.inc +1 -0
index c7073a5..1831fbb 100644
@@ -41,4 +41,5 @@ MAKE_DEPS		+= $(LIBMEM) $(LIBIPC)
 lib-clean:: $(LIBMEMDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 # vim: syntax=make
testcases/kernel/mem/hugetlb/hugemmap/Makefile +1 -0
index 15ae693..0b1b60c 100644
@@ -34,4 +34,5 @@ LDFLAGS			+= -L$(abs_builddir)/$(LIBMEMDIR)
 LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
 MAKE_DEPS		+= $(LIBMEM)
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/include/mem.h +1 -1
index cdc326b..16a65db 100644
@@ -67,7 +67,7 @@ void mount_mem(char *name, char *fs, char *options, char *path, char *path_new);
 void umount_mem(char *path, char *path_new);
 
 /* shared */
-long count_numa(long nodes[]);
+unsigned int get_a_numa_node(void (*cleanup_fn)(void));
 int  path_exist(const char *path, ...);
 long read_meminfo(char *item);
 void set_sys_tune(char *sys_file, long tune, int check);
testcases/kernel/mem/ksm/Makefile +1 -0
index c8e064c..b17845b 100644
@@ -40,4 +40,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/ksm/ksm02.c +4 -5
index 92f1493..5546309 100644
@@ -88,14 +88,14 @@ int main(int argc, char *argv[])
 	char *msg;
 	int size = 128, num = 3, unit = 1;
 	unsigned long nmask = 0;
-	long nodes[MAXNODES];
+	unsigned int node;
 
 	msg = parse_opts(argc, argv, ksm_options, ksm_usage);
 	if (msg != NULL)
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
 
-	if (count_numa(nodes) <= 1)
-		tst_brkm(TCONF, NULL, "required a NUMA system.");
+	node  = get_a_numa_node(tst_exit);
+	nmask = 1 << node;
 
 	setup();
 
@@ -103,7 +103,6 @@ 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,
@@ -115,7 +114,7 @@ int main(int argc, char *argv[])
 		}
 		create_same_memory(size, num, unit);
 
-		write_cpusets(nodes[1]);
+		write_cpusets(node);
 		create_same_memory(size, num, unit);
 	}
 	cleanup();
testcases/kernel/mem/ksm/ksm04.c +4 -5
index 8a31051..6ecf3d0 100644
@@ -88,14 +88,14 @@ int main(int argc, char *argv[])
 	char *msg;
 	int size = 128, num = 3, unit = 1;
 	unsigned long nmask = 0;
-	long nodes[MAXNODES];
+	unsigned int node;
 
 	msg = parse_opts(argc, argv, ksm_options, ksm_usage);
 	if (msg != NULL)
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
 
-	if (count_numa(nodes) <= 1)
-		tst_brkm(TCONF, NULL, "required a NUMA system.");
+	node  = get_a_numa_node(tst_exit);
+	nmask = 1 << node;
 
 	setup();
 
@@ -105,7 +105,6 @@ 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,
@@ -117,7 +116,7 @@ int main(int argc, char *argv[])
 		}
 		create_same_memory(size, num, unit);
 
-		write_cpusets(nodes[1]);
+		write_cpusets(node);
 		create_same_memory(size, num, unit);
 	}
 	cleanup();
testcases/kernel/mem/lib/Makefile +1 -0
index b22b1dd..399e290 100644
@@ -23,4 +23,5 @@ include $(top_srcdir)/include/mk/env_pre.mk
 CFLAGS			:= -I../include
 LIB			:= libmem.a
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/lib.mk
testcases/kernel/mem/lib/mem.c +34 -16

83 lines not on this page · raw message

testcases/kernel/mem/oom/Makefile +1 -0
index c8e064c..b17845b 100644
@@ -40,4 +40,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/oom/oom02.c +0 -4
index 551aad5..f0e784f 100644
@@ -48,7 +48,6 @@ int main(int argc, char *argv[])
 {
 	char *msg;
 	int lc;
-	long nodes[MAXNODES];
 
 	msg = parse_opts(argc, argv, NULL, NULL);
 	if (msg != NULL)
@@ -58,9 +57,6 @@ int main(int argc, char *argv[])
 	tst_brkm(TCONF, NULL, "test is not designed for 32-bit system.");
 #endif
 
-	if (count_numa(nodes) <= 1)
-		tst_brkm(TCONF, NULL, "required a NUMA system.");
-
 	setup();
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/mem/oom/oom04.c +0 -4
index 4b15b2f..15ba660 100644
@@ -49,7 +49,6 @@ int main(int argc, char *argv[])
 	char *msg;
 	int lc;
 	int swap_acc_on = 1;
-	long nodes[MAXNODES];
 	char buf[BUFSIZ], mem[BUFSIZ];
 
 	msg = parse_opts(argc, argv, NULL, NULL);
@@ -60,9 +59,6 @@ int main(int argc, char *argv[])
 	tst_brkm(TCONF, NULL, "test is not designed for 32-bit system.");
 #endif
 
-	if (count_numa(nodes) <= 1)
-		tst_brkm(TCONF, NULL, "required a NUMA system.");
-
 	setup();
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
testcases/kernel/mem/swapping/Makefile +1 -0
index c8e064c..b17845b 100644
@@ -40,4 +40,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/thp/Makefile +1 -0
index 9eb197e..3ef9288 100644
@@ -41,4 +41,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/tunable/Makefile +1 -0
index 9eb197e..3ef9288 100644
@@ -41,4 +41,5 @@ trunk-clean:: | lib-clean
 lib-clean:: $(LIBDIR)
 	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
 
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/vma/Makefile +1 -2
index 3899fcb..949db9a 100644
@@ -21,6 +21,5 @@ top_srcdir              ?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
 
-LDLIBS 			+= $(NUMA_LIBS)
-
+include $(top_srcdir)/testcases/kernel/include/lib.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/vma/vma02.c +12 -7
index f63bf77..13f0ce2 100644
@@ -43,6 +43,8 @@
 #include <unistd.h>
 #include "test.h"
 #include "usctest.h"
+#include "safe_macros.h"
+#include "numa_helper.h"
 
 char *TCID = "vma02";
 int TST_TOTAL = 1;
@@ -73,14 +75,17 @@ int main(int argc, char **argv)
 	msg = parse_opts(argc, argv, options, usage);
 	if (msg != NULL)
 		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
+
 	if (opt_node) {
-		node = atoi(optarg);
-		if (node < 1)
-			tst_brkm(TBROK, NULL,
-				"Number of NUMA nodes cannot be less that 1.");
-		numa_bitmask_setbit(nmask, node);
-	} else
-		numa_bitmask_setbit(nmask, 0);
+		node = SAFE_STRTOL(NULL, opt_nodestr, 1, LONG_MAX);
+	} else {
+		err = get_allowed_nodes(NH_MEMS|NH_MEMS, 1, &node);
+		if (err == -3)
+			tst_brkm(TCONF, NULL, "requires at least one node.");
+		else if (err < 0)
+			tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes");
+	}
+	numa_bitmask_setbit(nmask, node);
 
 	for (lc = 0; TEST_LOOPING(lc); lc++) {
 		Tst_count = 0;
testcases/kernel/mem/vma/vma04.c +8 -3
index cff0342..eca4567 100644
@@ -48,6 +48,7 @@
 #include "test.h"
 #include "usctest.h"
 #include "safe_macros.h"
+#include "numa_helper.h"
 
 char *TCID = "vma04";
 int TST_TOTAL = 5;
@@ -85,7 +86,7 @@ static void usage(void);
 
 int main(int argc, char **argv)
 {
-	int lc, node;
+	int lc, node, err;
 	char *msg;
 
 	msg = parse_opts(argc, argv, options, usage);
@@ -95,10 +96,14 @@ int main(int argc, char **argv)
 	nmask = numa_allocate_nodemask();
 	if (opt_node) {
 		node = SAFE_STRTOL(NULL, opt_nodestr, 1, LONG_MAX);
-		numa_bitmask_setbit(nmask, node);
 	} else {
-		numa_bitmask_setbit(nmask, 0);
+		err = get_allowed_nodes(NH_MEMS|NH_MEMS, 1, &node);
+		if (err == -3)
+			tst_brkm(TCONF, NULL, "requires at least one node.");
+		else if (err < 0)
+			tst_brkm(TBROK|TERRNO, NULL, "get_allowed_nodes");
 	}
+	numa_bitmask_setbit(nmask, node);
 
 	setup();
 

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#15 lore raw

Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

Quoted 280 lines · Caspar Zhang

This patch makes the tests in mem/ dir use numa_helper in libkerntest.

---
  testcases/kernel/mem/cpuset/Makefile           |    1 +
  testcases/kernel/mem/cpuset/cpuset01.c         |   16 ++++----
  testcases/kernel/mem/hugetlb/Makefile.inc      |    1 +
  testcases/kernel/mem/hugetlb/hugemmap/Makefile |    1 +
  testcases/kernel/mem/include/mem.h             |    2 +-
  testcases/kernel/mem/ksm/Makefile              |    1 +
  testcases/kernel/mem/ksm/ksm02.c               |    9 ++--
  testcases/kernel/mem/ksm/ksm04.c               |    9 ++--
  testcases/kernel/mem/lib/Makefile              |    1 +
  testcases/kernel/mem/lib/mem.c                 |   50 ++++++++++++++++--------
  testcases/kernel/mem/oom/Makefile              |    1 +
  testcases/kernel/mem/oom/oom02.c               |    4 --
  testcases/kernel/mem/oom/oom04.c               |    4 --
  testcases/kernel/mem/swapping/Makefile         |    1 +
  testcases/kernel/mem/thp/Makefile              |    1 +
  testcases/kernel/mem/tunable/Makefile          |    1 +
  testcases/kernel/mem/vma/Makefile              |    3 +-
  testcases/kernel/mem/vma/vma02.c               |   19 ++++++---
  testcases/kernel/mem/vma/vma04.c               |   11 ++++-
  19 files changed, 81 insertions(+), 55 deletions(-)

=======================================

testcases/kernel/mem/cpuset/Makefile +0 -0
index f0c34ba..c9d03bf 100644
@@ -41,5 +41,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/cpuset/cpuset01.c +1 -0
index b20485f..2be6953 100644
@@ -51,6 +51,7 @@
 #include·"test.h"
 #include·"usctest.h"
 #include·"mem.h"
+#include·"numa_helper.h"
 char·*TCID·=·"cpuset01";
 int·TST_TOTAL·=·1;
@@ -58,9 +59,9 @@
 int·TST_TOTAL·=·1;
 #if·HAVE_NUMA_H·&&·HAVE_LINUX_MEMPOLICY_H·&&·HAVE_NUMAIF_H·\

» &&·HAVE_MPOL_CONSTANTS
volatile·int·end;

testcases/kernel/mem/cpuset/cpuset01.c +2 -2
-static·long·nodes[MAXNODES];
-static·long·nnodes;
+static·int·*nodes;
+static·int·nnodes;

static·long·ncpus;
static·void·testcpuset(void);

testcases/kernel/mem/cpuset/cpuset01.c +5 -6
@@ -77,12 +78,11 @@
 int·main(int·argc,·char·*argv[])
 » » tst_brkm(TBROK,·NULL,·"OPTION·PARSING·ERROR·-·%s",·msg);
 » ncpus·=·count_cpu();
-» nnodes·=·count_numa(nodes);
-» tst_resm(TINFO,·"The·system·has·%ld·CPUs,·%ld·NUMA·nodes",
-» » » ncpus,·nnodes);
+» if·(get_allowed_nodes_arr(NH_MEMS|NH_CPUS,·&nnodes,·&nodes)·<·0)
+» » tst_brkm(TBROK|TERRNO,·NULL,·"get_allowed_nodes_arr");
 » if·(nnodes·<=·1)
-» » tst_brkm(TCONF,·NULL,·"required·a·NUMA·system.");
+» » tst_brkm(TCONF,·NULL,·"requires·a·NUMA·system.");
 » setup();
 » testcpuset();
@@ -115,10 +115,10 @@
 static·void·testcpuset(void)
 » }
 » for·(lc·=·0;·TEST_LOOPING(lc);·lc++)·{
 » » Tst_count·=·0;
-» » snprintf(buf,·BUFSIZ,·"%ld",·nodes[0]);
+» » snprintf(buf,·BUFSIZ,·"%d",·nodes[0]);
 » » write_cpuset_files(CPATH_NEW,·"mems",·buf);
-» » snprintf(buf,·BUFSIZ,·"%ld",·nodes[1]);
+» » snprintf(buf,·BUFSIZ,·"%d",·nodes[1]);
 » » write_cpuset_files(CPATH_NEW,·"mems",·buf);
 » }

=======================================

testcases/kernel/mem/hugetlb/Makefile.inc +0 -0
index c7073a5..1831fbb 100644
@@ -41,5 +41,6 @@
 MAKE_DEPS» » +=·$(LIBMEM)·$(LIBIPC)
 lib-clean::·$(LIBMEMDIR)

» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk #·vim:·syntax=make
=======================================

testcases/kernel/mem/hugetlb/hugemmap/Makefile +0 -0
index 15ae693..0b1b60c 100644
@@ -34,5 +34,6 @@
 LDFLAGS»» » +=·-L$(abs_builddir)/$(LIBMEMDIR)

LDLIBS» » » +=·$(NUMA_LIBS)·-lmem·-lltp MAKE_DEPS» » +=·$(LIBMEM) +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/include/mem.h +1 -1
index cdc326b..16a65db 100644
@@ -67,8 +67,8 @@
 void·mount_mem(char·*name,·char·*fs,·char·*options,·char·*path,·char·*path_new); 
 
 void·umount_mem(char·*path,·char·*path_new);
 /*·shared·*/
-long·count_numa(long·nodes[]);
+unsigned·int·get_a_numa_node(void·(*cleanup_fn)(void));
 int··path_exist(const·char·*path,·...);
 long·read_meminfo(char·*item);
 void·set_sys_tune(char·*sys_file,·long·tune,·int·check);

=======================================

testcases/kernel/mem/ksm/Makefile +0 -0
index c8e064c..b17845b 100644
@@ -40,5 +40,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/ksm/ksm02.c +4 -5
index 92f1493..5546309 100644
@@ -88,15 +88,15 @@
 int·main(int·argc,·char·*argv[])
 » char·*msg;
 » int·size·=·128,·num·=·3,·unit·=·1;
 » unsigned·long·nmask·=·0;
-» long·nodes[MAXNODES];
+» unsigned·int·node;
 » msg·=·parse_opts(argc,·argv,·ksm_options,·ksm_usage);
 » if·(msg·!=·NULL)
 » » tst_brkm(TBROK,·NULL,·"OPTION·PARSING·ERROR·-·%s",·msg);
-» if·(count_numa(nodes)·<=·1)
-» » tst_brkm(TCONF,·NULL,·"required·a·NUMA·system.");
+» node··=·get_a_numa_node(tst_exit);
+» nmask·=·1·<<·node;
 » setup();
@@ -103,8 +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,
@@ -115,8 +114,8 @@
 int·main(int·argc,·char·*argv[])
 » » }
 » » create_same_memory(size,·num,·unit);
-» » write_cpusets(nodes[1]);
+» » write_cpusets(node);
 » » create_same_memory(size,·num,·unit);
 » }
 » cleanup();

=======================================

testcases/kernel/mem/ksm/ksm04.c +4 -5
index 8a31051..6ecf3d0 100644
@@ -88,15 +88,15 @@
 int·main(int·argc,·char·*argv[])
 » char·*msg;
 » int·size·=·128,·num·=·3,·unit·=·1;
 » unsigned·long·nmask·=·0;
-» long·nodes[MAXNODES];
+» unsigned·int·node;
 » msg·=·parse_opts(argc,·argv,·ksm_options,·ksm_usage);
 » if·(msg·!=·NULL)
 » » tst_brkm(TBROK,·NULL,·"OPTION·PARSING·ERROR·-·%s",·msg);
-» if·(count_numa(nodes)·<=·1)
-» » tst_brkm(TCONF,·NULL,·"required·a·NUMA·system.");
+» node··=·get_a_numa_node(tst_exit);
+» nmask·=·1·<<·node;
 » setup();
@@ -105,8 +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,
@@ -117,8 +116,8 @@
 int·main(int·argc,·char·*argv[])
 » » }
 » » create_same_memory(size,·num,·unit);
-» » write_cpusets(nodes[1]);
+» » write_cpusets(node);
 » » create_same_memory(size,·num,·unit);
 » }
 » cleanup();

=======================================

testcases/kernel/mem/lib/Makefile +0 -0
index b22b1dd..399e290 100644
@@ -23,5 +23,6 @@

include·$(top_srcdir)/include/mk/env_pre.mk CFLAGS» » » :=·-I../include
LIB» » » :=·libmem.a +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/lib.mk
=======================================

testcases/kernel/mem/lib/mem.c +1 -0
index 81410d8..2077003 100644
@@ -22,6 +22,7 @@
 #include·"safe_macros.h"
 #include·"_private.h"
 #include·"mem.h"
+#include·"numa_helper.h"
 /*·OOM·*/
@@ -67,8 +68,12 @@
 void·oom(int·testcase,·int·mempolicy,·int·lite)
 #if·HAVE_NUMA_H·&&·HAVE_LINUX_MEMPOLICY_H·&&·HAVE_NUMAIF_H·\

» &&·HAVE_MPOL_CONSTANTS
» unsigned·long·nmask·=·0;
-» long·nodes[MAXNODES];
+» unsigned·int·node;
+
+» if·(mempolicy)
+» » node·=·get_a_numa_node(cleanup);
+» nmask·+=·1·<<·node;
#endif
» switch·(pid·=·fork())·{

testcases/kernel/mem/lib/mem.c +0 -0
@@ -76,9 +81,7 @@
 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,

testcases/kernel/mem/lib/mem.c +7 -12
@@ -107,13 +110,9 @@
 void·testoom(int·mempolicy,·int·lite,·int·numa)
 {
 » long·nodes[MAXNODES];
-» if·(numa·&&·!mempolicy)·{
-» » if·(count_numa(nodes)·<=·1)
-» » » tst_brkm(TCONF,·cleanup,·"required·a·NUMA·system.");
-» » /*·write·cpusets·to·2nd·node·*/
-» » write_cpusets(nodes[1]);
-» }
+» if·(numa·&&·!mempolicy)
+» » write_cpusets(get_a_numa_node(cleanup));
 » tst_resm(TINFO,·"start·normal·OOM·testing.");
 » oom(NORMAL,·mempolicy,·lite);
@@ -715,17 +714,36 @@
 void·mount_mem(char·*name,·char·*fs,·char·*options,·char·*path,·char·*path_new) 
 
 /*·shared·*/
-long·count_numa(long·nodes[])
+/*·Warning:·*DO·NOT*·use·this·function·in·child·*/
+unsigned·int·get_a_numa_node(void·(*cleanup_fn)(void))
 {
-» long·nnodes,·i;
+» unsigned·int·nd1,·nd2;
+» int·ret;
-» nnodes·=·0;
-» for·(i·=·0;·i·<=·MAXNODES;·i++)
-» » if·(path_exist(PATH_SYS_SYSTEM·"/node/node%d",·i))
-» » » nodes[nnodes++]·=·i;
+» ret·=·get_allowed_nodes(0,·2,·&nd1,·&nd2);

testcases/kernel/mem/lib/mem.c line 731

Quoted 10 lines
testcases/kernel/mem/lib/mem.c +9 -1
+» switch·(ret)·{
+» case·0:
+» » break;
+» case·-3:
+» » tst_brkm(TCONF,·cleanup_fn,·"requires·a·NUMA·system.");
+» default:
+» » tst_brkm(TBROK|TERRNO,·cleanup_fn,·"1st·get_allowed_nodes");
+» }
-» return·nnodes;
+» ret·=·get_allowed_nodes(NH_MEMS|NH_CPUS,·1,·&nd1);

Caspar, I found get_a_numa_node always return the first node id, which will make all cases called the function
only run in the first node, I don't think it's a good way, it decrease the coverage.

we should prefer to run cases on the second node, we can chose the first only if it just only has
one node with NH_MEMS|NH_CPUS. do you think so?

and others is good for me.

Thanks,
Zhouping

Quoted 196 lines
testcases/kernel/mem/lib/mem.c +12 -0
+» switch·(ret)·{
+» case·0:
+» » tst_resm(TINFO,·"get·node%lu.",·nd1);
+» » return·nd1;
+» case·-3:
+» » tst_brkm(TCONF,·cleanup_fn,·"requires·a·NUMA·system·that·has·"
+» » » » "at·least·one·node·with·both·memory·and·CPU·"
+» » » » "available.");
+» default:
+» » break;
+» }
+» tst_brkm(TBROK|TERRNO,·cleanup_fn,·"2nd·get_allowed_nodes");
 }
 int·path_exist(const·char·*path,·...)

=======================================

testcases/kernel/mem/oom/Makefile +0 -0
index c8e064c..b17845b 100644
@@ -40,5 +40,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/oom/oom02.c +0 -4
index 551aad5..f0e784f 100644
@@ -48,8 +48,7 @@
 int·main(int·argc,·char·*argv[])
 {
 » char·*msg;
 » int·lc;
-» long·nodes[MAXNODES];
 » msg·=·parse_opts(argc,·argv,·NULL,·NULL);
 » if·(msg·!=·NULL)
@@ -58,10 +57,7 @@
 int·main(int·argc,·char·*argv[])
 » tst_brkm(TCONF,·NULL,·"test·is·not·designed·for·32-bit·system.");
 #endif
-» if·(count_numa(nodes)·<=·1)
-» » tst_brkm(TCONF,·NULL,·"required·a·NUMA·system.");
-
 » setup();
 » for·(lc·=·0;·TEST_LOOPING(lc);·lc++)·{

=======================================

testcases/kernel/mem/oom/oom04.c +0 -4
index 4b15b2f..15ba660 100644
@@ -49,8 +49,7 @@
 int·main(int·argc,·char·*argv[])
 » char·*msg;
 » int·lc;
 » int·swap_acc_on·=·1;
-» long·nodes[MAXNODES];
 » char·buf[BUFSIZ],·mem[BUFSIZ];
 » msg·=·parse_opts(argc,·argv,·NULL,·NULL);
@@ -60,10 +59,7 @@
 int·main(int·argc,·char·*argv[])
 » tst_brkm(TCONF,·NULL,·"test·is·not·designed·for·32-bit·system.");
 #endif
-» if·(count_numa(nodes)·<=·1)
-» » tst_brkm(TCONF,·NULL,·"required·a·NUMA·system.");
-
 » setup();
 » for·(lc·=·0;·TEST_LOOPING(lc);·lc++)·{

=======================================

testcases/kernel/mem/swapping/Makefile +0 -0
index c8e064c..b17845b 100644
@@ -40,5 +40,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/thp/Makefile +0 -0
index 9eb197e..3ef9288 100644
@@ -41,5 +41,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/tunable/Makefile +0 -0
index 9eb197e..3ef9288 100644
@@ -41,5 +41,6 @@

trunk-clean::·|·lib-clean lib-clean::·$(LIBDIR)
» $(MAKE)·-C·$^·-f·"$(abs_srcdir)/$^/Makefile"·clean +include·$(top_srcdir)/testcases/kernel/include/lib.mk include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/vma/Makefile +0 -0
index 3899fcb..949db9a 100644
@@ -21,7 +21,6 @@

top_srcdir··············?=·../../../..
include·$(top_srcdir)/include/mk/testcases.mk

testcases/kernel/mem/vma/Makefile +1 -2
-LDLIBS·»» » +=·$(NUMA_LIBS)
-
+include·$(top_srcdir)/testcases/kernel/include/lib.mk

include·$(top_srcdir)/include/mk/generic_leaf_target.mk
=======================================

testcases/kernel/mem/vma/vma02.c +12 -7
index f63bf77..13f0ce2 100644
@@ -43,6 +43,8 @@
 #include·<unistd.h>
 #include·"test.h"
 #include·"usctest.h"
+#include·"safe_macros.h"
+#include·"numa_helper.h"
 char·*TCID·=·"vma02";
 int·TST_TOTAL·=·1;
@@ -73,15 +75,18 @@
 int·main(int·argc,·char·**argv)
 » msg·=·parse_opts(argc,·argv,·options,·usage);
 » if·(msg·!=·NULL)
 » » tst_brkm(TBROK,·NULL,·"OPTION·PARSING·ERROR·-·%s",·msg);
+
 » if·(opt_node)·{
-» » node·=·atoi(optarg);
-» » if·(node·<·1)
-» » » tst_brkm(TBROK,·NULL,
-» » » » "Number·of·NUMA·nodes·cannot·be·less·that·1.");
-» » numa_bitmask_setbit(nmask,·node);
-» }·else
-» » numa_bitmask_setbit(nmask,·0);
+» » node·=·SAFE_STRTOL(NULL,·opt_nodestr,·1,·LONG_MAX);
+» }·else·{
+» » err·=·get_allowed_nodes(NH_MEMS|NH_MEMS,·1,·&node);
+» » if·(err·==·-3)
+» » » tst_brkm(TCONF,·NULL,·"requires·at·least·one·node.");
+» » else·if·(err·<·0)
+» » » tst_brkm(TBROK|TERRNO,·NULL,·"get_allowed_nodes");
+» }
+» numa_bitmask_setbit(nmask,·node);
 » for·(lc·=·0;·TEST_LOOPING(lc);·lc++)·{
 » » Tst_count·=·0;

=======================================

testcases/kernel/mem/vma/vma04.c +8 -4
index cff0342..eca4567 100644
@@ -48,6 +48,7 @@
 #include·"test.h"
 #include·"usctest.h"
 #include·"safe_macros.h"
+#include·"numa_helper.h"
 char·*TCID·=·"vma04";
 int·TST_TOTAL·=·5;
@@ -85,8 +86,8 @@
 static·void·usage(void);
 int·main(int·argc,·char·**argv)
 {
-» int·lc,·node;
+» int·lc,·node,·err;
 » char·*msg;
 » msg·=·parse_opts(argc,·argv,·options,·usage);
@@ -95,11 +96,15 @@
 int·main(int·argc,·char·**argv)
 » nmask·=·numa_allocate_nodemask();
 » if·(opt_node)·{
 » » node·=·SAFE_STRTOL(NULL,·opt_nodestr,·1,·LONG_MAX);
-» » numa_bitmask_setbit(nmask,·node);
 » }·else·{
-» » numa_bitmask_setbit(nmask,·0);
+» » err·=·get_allowed_nodes(NH_MEMS|NH_MEMS,·1,·&node);
+» » if·(err·==·-3)
+» » » tst_brkm(TCONF,·NULL,·"requires·at·least·one·node.");
+» » else·if·(err·<·0)
+» » » tst_brkm(TBROK|TERRNO,·NULL,·"get_allowed_nodes");
 » }
+» numa_bitmask_setbit(nmask,·node);
 » setup();
------------------------------------------------------------------------------

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/

Quoted 8 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#16 lore raw

Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

----- Original Message -----

Quoted 10 lines

From: "Zhouping Liu" <[email protected]>
To: "Caspar Zhang" <[email protected]>
Cc: "LTP List" <[email protected]>
Sent: Friday, 10 August, 2012 10:02:01 AM
Subject: Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

Quoted 2 lines

-» return·nnodes;
+» ret·=·get_allowed_nodes(NH_MEMS|NH_CPUS,·1,·&nd1);

Quoted 6 lines

Caspar, I found get_a_numa_node always return the first node id, which
will make all cases called the function
only run in the first node, I don't think it's a good way, it decrease
the coverage.

We had a discussion with Caspar on this topic:
http://article.gmane.org/gmane.linux.ltp/16495

Can you explain why a specific node matters here?

Regards,
Jan

Quoted 10 lines

we should prefer to run cases on the second node, we can chose the first
only if it just only has
one node with NH_MEMS|NH_CPUS. do you think so?

and others is good for me.

Thanks,
Zhouping

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#17 lore raw

Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

----- Original Message -----

Quoted 26 lines

From: "Jan Stancek" <[email protected]>
To: "Zhouping Liu" <[email protected]>
Cc: "LTP List" <[email protected]>, "Caspar Zhang" <[email protected]>
Sent: Friday, August 10, 2012 4:24:25 PM
Subject: Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

----- Original Message -----

Quoted 10 lines

From: "Zhouping Liu" <[email protected]>
To: "Caspar Zhang" <[email protected]>
Cc: "LTP List" <[email protected]>
Sent: Friday, 10 August, 2012 10:02:01 AM
Subject: Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

Quoted 2 lines

-» return·nnodes;
+» ret·=·get_allowed_nodes(NH_MEMS|NH_CPUS,·1,·&nd1);

Quoted 6 lines

Caspar, I found get_a_numa_node always return the first node id, which
will make all cases called the function
only run in the first node, I don't think it's a good way, it decrease
the coverage.

Quoted 4 lines

We had a discussion with Caspar on this topic:
http://article.gmane.org/gmane.linux.ltp/16495

Can you explain why a specific node matters here?

yeah, I didn't carefully read the discussion before, and discussed with Caspar, I agree with the current solution. so Reviewed-by: Zhouping Liu <[email protected]>

but always I'm worrying it maybe has difference between different nodes, especially in old version, such as RHEL5, which didn't improve the performance of scheduling in NUMA system, so that more process will choose the first node(I guess), and in a large NUMA system, which have 2+ available NUMA nodes(contain memory and CPUs), I think the second node represent more universality than first one, that's all my supposing, so I will investigating the supposing, actually if it exists the difference between different nodes, I will do a new patch.

Thanks,
Zhouping

Quoted 16 lines

Regards,
Jan

Quoted 10 lines

we should prefer to run cases on the second node, we can chose the first
only if it just only has
one node with NH_MEMS|NH_CPUS. do you think so?

and others is good for me.

Thanks,
Zhouping

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#18 lore raw

Re: [LTP] [PATCH resend 5/6] mm: use new numa_helper

In reply to Zhouping Liu
Quoted 10 lines · Zhouping Liu

Caspar, I found get_a_numa_node always return the first node id, which will make all cases called the function
only run in the first node, I don't think it's a good way, it decrease the coverage.

we should prefer to run cases on the second node, we can chose the first only if it just only has
one node with NH_MEMS|NH_CPUS. do you think so?

and others is good for me.

Jan and I discussed this issue before:

Quoted 3 lines · Jan Stancek
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Do you think it will affect test coverage if we always test first node?

I'm leaning towards "no". I'm assuming oom01 is using default mem

policy,

Quoted 1 line
Quoted 1 line

so it can allocate memory from any node (including second one).

And I agree with this opinion. What you think?

Caspar

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#19 lore raw

PATCH RESEND 6/6 mm: add common Makefile include: libmem.mk

In reply to Caspar Zhang

libmem.mk is used as a common Makefile used by tests under mem/ dir to avoid duplicated libmem-related lines.

---
 testcases/kernel/mem/cpuset/Makefile           |   23 +-------------
 testcases/kernel/mem/hugetlb/Makefile.inc      |   19 +++--------
 testcases/kernel/mem/hugetlb/hugemmap/Makefile |   13 +-------
 testcases/kernel/mem/include/libmem.mk         |   40 ++++++++++++++++++++++++
 testcases/kernel/mem/ksm/Makefile              |   23 +-------------
 testcases/kernel/mem/oom/Makefile              |   23 +-------------
 testcases/kernel/mem/swapping/Makefile         |   23 +-------------
 testcases/kernel/mem/thp/Makefile              |   23 +-------------
 testcases/kernel/mem/tunable/Makefile          |   23 +-------------
 testcases/kernel/mem/vma/Makefile              |    3 +-
 10 files changed, 54 insertions(+), 159 deletions(-)
 create mode 100644 testcases/kernel/mem/include/libmem.mk
testcases/kernel/mem/cpuset/Makefile +1 -22
index c9d03bf..8e41c02 100644
@@ -20,26 +20,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS 			+= $(NUMA_LIBS) -lmem -lltp -lm
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/hugetlb/Makefile.inc +6 -13
index 1831fbb..cc0ada6 100644
@@ -23,23 +23,16 @@
 # DO NOT USE THIS FILE FOR hugetlb / lib!!!
 LIBIPCDIR		:= ../lib
 LIBIPC			:= $(LIBIPCDIR)/libipc_hugetlb.a
+
 $(LIBIPCDIR):
 	mkdir -p "$@"
 $(LIBIPC): $(LIBIPCDIR)
 	$(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all
 
-LIBMEMDIR		:= ../../lib
-LIBMEM			:= $(LIBMEMDIR)/libmem.a
-$(LIBMEM): $(LIBMEMDIR)
-	$(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all
-
-CPPFLAGS		+= -I$(abs_srcdir)/$(LIBIPCDIR) -I$(abs_srcdir)/../../include
-LDFLAGS			+= -L$(abs_builddir)/$(LIBIPCDIR) -L$(abs_builddir)/$(LIBMEMDIR)
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp -lipc_hugetlb
-MAKE_DEPS		+= $(LIBMEM) $(LIBIPC)
-
-lib-clean:: $(LIBMEMDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+CPPFLAGS		+= -I$(abs_srcdir)/$(LIBIPCDIR)
+LDFLAGS			+= -L$(abs_builddir)/$(LIBIPCDIR)
+LDLIBS			+= -lipc_hugetlb
+MAKE_DEPS		+= $(LIBIPC)
 
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 # vim: syntax=make
testcases/kernel/mem/hugetlb/hugemmap/Makefile +1 -12
index 0b1b60c..71da630 100644
@@ -23,16 +23,5 @@
 top_srcdir		?= ../../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LIBMEMDIR		:= ../../lib
-LIBMEM			:= $(LIBMEMDIR)/libmem.a
-$(LIBMEM): $(LIBMEMDIR)
-	$(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all
-
-CPPFLAGS		+= -I$(abs_srcdir)/$(LIBMEMDIR) -I$(abs_srcdir)/../../include
-LDFLAGS			+= -L$(abs_builddir)/$(LIBMEMDIR)
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-MAKE_DEPS		+= $(LIBMEM)
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/include/libmem.mk new file +40 -0
new file mode 100644
index 0000000..22efda2
@@ -0,0 +1,40 @@
+#
+#  Copyright (C) 2012  Red Hat, Inc.
+#
+#  This program is free software;  you can redistribute it and/or modify
+#  it under the terms of the GNU General Public License as published by
+#  the Free Software Foundation; either version 2 of the License, or
+#  (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY;  without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
+#  the GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program;  if not, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+MEM_DIR			:= $(top_srcdir)/testcases/kernel/mem
+LIBMEM_DIR		:= $(MEM_DIR)/lib
+LIBMEM			:= $(LIBMEM_DIR)/libmem.a
+FILTER_OUT_DIRS		:= $(LIBMEM_DIR)
+CFLAGS			+= -I$(MEM_DIR)/include
+LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
+LDFLAGS			+= -L$(LIBMEM_DIR)
+
+$(LIBMEM_DIR):
+	mkdir -p "$@"
+
+$(LIBMEM): $(LIBMEM_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
+
+MAKE_DEPS		+= $(LIBMEM)
+
+trunk-clean:: | lib-clean
+
+lib-clean:: $(LIBMEM_DIR)
+	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
+
+include $(top_srcdir)/testcases/kernel/include/lib.mk
testcases/kernel/mem/ksm/Makefile +1 -22
index b17845b..128d7bc 100644
@@ -19,26 +19,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/oom/Makefile +1 -22
index b17845b..128d7bc 100644
@@ -19,26 +19,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/swapping/Makefile +1 -22
index b17845b..128d7bc 100644
@@ -19,26 +19,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/thp/Makefile +1 -22
index 3ef9288..867dcf0 100644
@@ -20,26 +20,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/tunable/Makefile +1 -22
index 3ef9288..867dcf0 100644
@@ -20,26 +20,5 @@
 top_srcdir		?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-LDLIBS			+= $(NUMA_LIBS) -lmem -lltp
-LIBDIR			:= ../lib
-LIB			:= $(LIBDIR)/libmem.a
-FILTER_OUT_DIRS		:= $(LIBDIR)
-CFLAGS			+= -I../include
-LDFLAGS			+= -L$(LIBDIR)
-
-$(LIBDIR):
-	mkdir -p "$@"
-
-$(LIB): $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" all
-
-MAKE_DEPS		:= $(LIB)
-
-trunk-clean:: | lib-clean
-
-lib-clean:: $(LIBDIR)
-	$(MAKE) -C $^ -f "$(abs_srcdir)/$^/Makefile" clean
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/mem/vma/Makefile +1 -2
index 949db9a..b323dbf 100644
@@ -20,6 +20,5 @@
 top_srcdir              ?= ../../../..
 
 include $(top_srcdir)/include/mk/testcases.mk
-
-include $(top_srcdir)/testcases/kernel/include/lib.mk
+include $(top_srcdir)/testcases/kernel/mem/include/libmem.mk
 include $(top_srcdir)/include/mk/generic_leaf_target.mk

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#20 lore raw
In reply to Caspar Zhang

Caspar,

thanks for putting it all together. I tested it on x86_64 with and without libnuma-devel. Applies cleanly, I didn't notice anything broken while running modified testcases.

Patches 1,2,4,5 look good to me.
Patch 3 - I replied to this one already (no functional issue with this version) Patch 6 - Only tested

Regards,
Jan

----- Original Message -----

Quoted 93 lines

From: "Caspar Zhang" <[email protected]>
To: "LTP List" <[email protected]>
Sent: Thursday, 9 August, 2012 8:15:36 AM
Subject: [LTP] [PATCH resend 0/6] NUMA and follow-up fix

Resending the whole patch series (including Jan's 2 patches) for easier
reviewing.

updates:
syscalls/numa: check syscall availability
remove TEST() macro and use syscall() directly.
numa_helper: move to libkerntest
merged the library cleaning fix to this one.
mm: use new numa_helper
the same as previous V3 version, which already has Jan's reivew.

Caspar Zhang (4):
syscalls/numa: check syscall availability
numa_helper: move to libkerntest
mm: use new numa_helper
mm: add common Makefile include: libmem.mk

Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes() update testcases to use flag for get_allowed_nodes()

 testcases/kernel/Makefile                          |    4 +
 testcases/kernel/include/lib.mk                    |   37 +++
 testcases/kernel/include/numa_helper.h             |   37 +++
 testcases/kernel/lib/Makefile                      |   29 +++
 testcases/kernel/lib/numa_helper.c                 |  266
 ++++++++++++++++++++
 testcases/kernel/mem/cpuset/Makefile               |   22 +--
 testcases/kernel/mem/cpuset/cpuset01.c             |   16 +-
 testcases/kernel/mem/hugetlb/Makefile.inc          |   18 +-
 testcases/kernel/mem/hugetlb/hugemmap/Makefile     |   12 +-
 testcases/kernel/mem/include/libmem.mk             |   40 +++
 testcases/kernel/mem/include/mem.h                 |    2 +-
 testcases/kernel/mem/ksm/Makefile                  |   22 +--
 testcases/kernel/mem/ksm/ksm02.c                   |    9 +-
 testcases/kernel/mem/ksm/ksm04.c                   |    9 +-
 testcases/kernel/mem/lib/Makefile                  |    1 +
 testcases/kernel/mem/lib/mem.c                     |   50 +++--
 testcases/kernel/mem/oom/Makefile                  |   22 +--
 testcases/kernel/mem/oom/oom02.c                   |    4 -
 testcases/kernel/mem/oom/oom04.c                   |    4 -
 testcases/kernel/mem/swapping/Makefile             |   22 +--
 testcases/kernel/mem/thp/Makefile                  |   22 +--
 testcases/kernel/mem/tunable/Makefile              |   22 +--
 testcases/kernel/mem/vma/Makefile                  |    4 +-
 testcases/kernel/mem/vma/vma02.c                   |   19 +-
 testcases/kernel/mem/vma/vma04.c                   |   11 +-
 testcases/kernel/syscalls/get_mempolicy/Makefile   |    2 +-
 .../syscalls/get_mempolicy/get_mempolicy01.c       |   15 +-
 testcases/kernel/syscalls/mbind/Makefile           |    2 +-
 testcases/kernel/syscalls/mbind/mbind01.c          |   14 +-
 testcases/kernel/syscalls/move_pages/Makefile      |    2 +-
 .../kernel/syscalls/move_pages/move_pages02.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages03.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages04.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages05.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages06.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages07.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages08.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages09.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages10.c      |    5 +-
 .../kernel/syscalls/move_pages/move_pages11.c      |    5 +-
 .../syscalls/move_pages/move_pages_support.c       |    8 +-
 testcases/kernel/syscalls/numa/Makefile            |   22 --
 testcases/kernel/syscalls/numa/Makefile.inc        |   27 --
 testcases/kernel/syscalls/numa/lib/Makefile        |   26 --
 testcases/kernel/syscalls/numa/lib/numa_helper.c   |  165
 ------------
 testcases/kernel/syscalls/numa/lib/numa_helper.h   |   33 ---
 46 files changed, 562 insertions(+), 508 deletions(-)
 create mode 100644 testcases/kernel/include/lib.mk
 create mode 100644 testcases/kernel/include/numa_helper.h
 create mode 100644 testcases/kernel/lib/Makefile
 create mode 100644 testcases/kernel/lib/numa_helper.c
 create mode 100644 testcases/kernel/mem/include/libmem.mk
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc
 delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c
 delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h

--
1.7.8.6

Quoted 13 lines

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#21 lore raw

PATCH RESEND v2 3/6 syscalls/numa: check syscall availability

In reply to Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in setup() function by using the macro syscall() implemented in linux_syscall_numbers.h, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch

---
 .../syscalls/get_mempolicy/get_mempolicy01.c       |    3 +++
 testcases/kernel/syscalls/mbind/mbind01.c          |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)
testcases/kernel/syscalls/get_mempolicy/get_mempolicy01.c +3 -0
index d0e372c..34fc52a 100644
@@ -339,6 +339,9 @@ static void cleanup(void)
 
 static void setup(void)
 {
+	/* check syscall availability */
+	syscall(__NR_get_mempolicy, NULL, NULL, 0, NULL, 0);
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }
testcases/kernel/syscalls/mbind/mbind01.c +3 -0
index 2fc6f5a..9e877f1 100644
@@ -300,6 +300,9 @@ TEST_END:
 
 static void setup(void)
 {
+	/* check syscall availability */
+	syscall(__NR_mbind, NULL, 0, 0, NULL, 0, 0);
+
 	TEST_PAUSE;
 	tst_tmpdir();
 }

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reviewed-by on v2 3/6
#22 lore raw

Re: [LTP] [PATCH resend v2 3/6] syscalls/numa: check syscall availability

Quoted 9 lines · Caspar Zhang

some NUMA related syscalls: mbind, get_mempolicy are not supported on some arches (e.g. i386), this patch checks the syscalls' availability in setup() function by using the macro syscall() implemented in linux_syscall_numbers.h, if the syscall is not implemented on the system, a TCONF message will be given like this:

get_mempolicy01 1 TCONF : syscall __NR_get_mempolicy01 not supported on your arch

Thanks,
Zhouping

Quoted 15 lines
---
  .../syscalls/get_mempolicy/get_mempolicy01.c       |    3 +++
  testcases/kernel/syscalls/mbind/mbind01.c          |    3 +++
  2 files changed, 6 insertions(+), 0 deletions(-)

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#23 lore raw
In reply to Caspar Zhang

Hi,

Quoted 2 lines · Caspar Zhang

Resending the whole patch series (including Jan's 2 patches) for easier reviewing.

Caspar, after applying the patch set, I met the bellow compiling error when do 'make install':

... snip ...
make[4]: Leaving directory `/root/ltp_new/testcases/kernel/syscalls/umask'
make[3]: Leaving directory `/root/ltp_new/testcases/kernel/syscalls'
make[3]: Entering directory `/root/ltp_new/testcases/kernel/lib'
../../../include/mk/env_post.mk:94: warning: overriding recipe for target /opt/ltp/lib' ../../../include/mk/env_post.mk:94: warning: ignoring old recipe for target /opt/ltp/lib' ../../../include/mk/env_post.mk:96: warning: overriding recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/env_post.mk:96: warning: ignoring old recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/generic_trunk_target.inc:89: CURDIR is: /root/ltp_new/testcases/kernel/lib ../../../include/mk/generic_trunk_target.inc:89: *** SUBDIRS empty -- did you want generic_leaf_target instead?. Stop. make[3]: Leaving directory `/root/ltp_new/testcases/kernel/lib'
make[2]: *** [install] Error 2
make[2]: Leaving directory `/root/ltp_new/testcases/kernel'
make[1]: *** [install] Error 2
make[1]: Leaving directory `/root/ltp_new/testcases'
make: *** [testcases-install] Error 2

Thanks,
Zhouping

Quoted 87 lines

updates:
syscalls/numa: check syscall availability
remove TEST() macro and use syscall() directly.
numa_helper: move to libkerntest
merged the library cleaning fix to this one.
mm: use new numa_helper
the same as previous V3 version, which already has Jan's reivew.

Caspar Zhang (4):
syscalls/numa: check syscall availability
numa_helper: move to libkerntest
mm: use new numa_helper
mm: add common Makefile include: libmem.mk

Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes() update testcases to use flag for get_allowed_nodes()

  testcases/kernel/Makefile                          |    4 +
  testcases/kernel/include/lib.mk                    |   37 +++
  testcases/kernel/include/numa_helper.h             |   37 +++
  testcases/kernel/lib/Makefile                      |   29 +++
  testcases/kernel/lib/numa_helper.c                 |  266 ++++++++++++++++++++
  testcases/kernel/mem/cpuset/Makefile               |   22 +--
  testcases/kernel/mem/cpuset/cpuset01.c             |   16 +-
  testcases/kernel/mem/hugetlb/Makefile.inc          |   18 +-
  testcases/kernel/mem/hugetlb/hugemmap/Makefile     |   12 +-
  testcases/kernel/mem/include/libmem.mk             |   40 +++
  testcases/kernel/mem/include/mem.h                 |    2 +-
  testcases/kernel/mem/ksm/Makefile                  |   22 +--
  testcases/kernel/mem/ksm/ksm02.c                   |    9 +-
  testcases/kernel/mem/ksm/ksm04.c                   |    9 +-
  testcases/kernel/mem/lib/Makefile                  |    1 +
  testcases/kernel/mem/lib/mem.c                     |   50 +++--
  testcases/kernel/mem/oom/Makefile                  |   22 +--
  testcases/kernel/mem/oom/oom02.c                   |    4 -
  testcases/kernel/mem/oom/oom04.c                   |    4 -
  testcases/kernel/mem/swapping/Makefile             |   22 +--
  testcases/kernel/mem/thp/Makefile                  |   22 +--
  testcases/kernel/mem/tunable/Makefile              |   22 +--
  testcases/kernel/mem/vma/Makefile                  |    4 +-
  testcases/kernel/mem/vma/vma02.c                   |   19 +-
  testcases/kernel/mem/vma/vma04.c                   |   11 +-
  testcases/kernel/syscalls/get_mempolicy/Makefile   |    2 +-
  .../syscalls/get_mempolicy/get_mempolicy01.c       |   15 +-
  testcases/kernel/syscalls/mbind/Makefile           |    2 +-
  testcases/kernel/syscalls/mbind/mbind01.c          |   14 +-
  testcases/kernel/syscalls/move_pages/Makefile      |    2 +-
  .../kernel/syscalls/move_pages/move_pages02.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages03.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages04.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages05.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages06.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages07.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages08.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages09.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages10.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages11.c      |    5 +-
  .../syscalls/move_pages/move_pages_support.c       |    8 +-
  testcases/kernel/syscalls/numa/Makefile            |   22 --
  testcases/kernel/syscalls/numa/Makefile.inc        |   27 --
  testcases/kernel/syscalls/numa/lib/Makefile        |   26 --
  testcases/kernel/syscalls/numa/lib/numa_helper.c   |  165 ------------
  testcases/kernel/syscalls/numa/lib/numa_helper.h   |   33 ---
  46 files changed, 562 insertions(+), 508 deletions(-)

create mode 100644 testcases/kernel/include/lib.mk create mode 100644 testcases/kernel/include/numa_helper.h create mode 100644 testcases/kernel/lib/Makefile
create mode 100644 testcases/kernel/lib/numa_helper.c create mode 100644 testcases/kernel/mem/include/libmem.mk delete mode 100644 testcases/kernel/syscalls/numa/Makefile delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h

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

Quoted 4 lines

_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#24 lore raw
Quoted 23 lines · Zhouping Liu

Hi,

Quoted 2 lines · Caspar Zhang

Resending the whole patch series (including Jan's 2 patches) for easier reviewing.

Caspar, after applying the patch set, I met the bellow compiling error when do 'make install':

... snip ...
make[4]: Leaving directory /root/ltp_new/testcases/kernel/syscalls/umask' make[3]: Leaving directory /root/ltp_new/testcases/kernel/syscalls' make[3]: Entering directory /root/ltp_new/testcases/kernel/lib' ../../../include/mk/env_post.mk:94: warning: overriding recipe for target /opt/ltp/lib'
../../../include/mk/env_post.mk:94: warning: ignoring old recipe for target `/opt/ltp/lib'
../../../include/mk/env_post.mk:96: warning: overriding recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/env_post.mk:96: warning: ignoring old recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/generic_trunk_target.inc:89: CURDIR is:
/root/ltp_new/testcases/kernel/lib

Quoted 8 lines

../../../include/mk/generic_trunk_target.inc:89: *** SUBDIRS empty -- did you want generic_leaf_target instead?. Stop.
make[3]: Leaving directory `/root/ltp_new/testcases/kernel/lib' make[2]: *** [install] Error 2
make[2]: Leaving directory `/root/ltp_new/testcases/kernel' make[1]: *** [install] Error 2
make[1]: Leaving directory `/root/ltp_new/testcases'
make: *** [testcases-install] Error 2

Thanks for trying the patches out, can you try 4/6 v2?

Caspar

Quoted 96 lines

Thanks,
Zhouping

Quoted 91 lines

updates:
syscalls/numa: check syscall availability
remove TEST() macro and use syscall() directly.
numa_helper: move to libkerntest
merged the library cleaning fix to this one.
mm: use new numa_helper
the same as previous V3 version, which already has Jan's reivew.

Caspar Zhang (4):
syscalls/numa: check syscall availability
numa_helper: move to libkerntest
mm: use new numa_helper
mm: add common Makefile include: libmem.mk

Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes() update testcases to use flag for get_allowed_nodes()

  testcases/kernel/Makefile                          |    4 +
  testcases/kernel/include/lib.mk                    |   37 +++
  testcases/kernel/include/numa_helper.h             |   37 +++
  testcases/kernel/lib/Makefile                      |   29 +++
  testcases/kernel/lib/numa_helper.c                 |  266 ++++++++++++++++++++
  testcases/kernel/mem/cpuset/Makefile               |   22 +--
  testcases/kernel/mem/cpuset/cpuset01.c             |   16 +-
  testcases/kernel/mem/hugetlb/Makefile.inc          |   18 +-
  testcases/kernel/mem/hugetlb/hugemmap/Makefile     |   12 +-
  testcases/kernel/mem/include/libmem.mk             |   40 +++
  testcases/kernel/mem/include/mem.h                 |    2 +-
  testcases/kernel/mem/ksm/Makefile                  |   22 +--
  testcases/kernel/mem/ksm/ksm02.c                   |    9 +-
  testcases/kernel/mem/ksm/ksm04.c                   |    9 +-
  testcases/kernel/mem/lib/Makefile                  |    1 +
  testcases/kernel/mem/lib/mem.c                     |   50 +++--
  testcases/kernel/mem/oom/Makefile                  |   22 +--
  testcases/kernel/mem/oom/oom02.c                   |    4 -
  testcases/kernel/mem/oom/oom04.c                   |    4 -
  testcases/kernel/mem/swapping/Makefile             |   22 +--
  testcases/kernel/mem/thp/Makefile                  |   22 +--
  testcases/kernel/mem/tunable/Makefile              |   22 +--
  testcases/kernel/mem/vma/Makefile                  |    4 +-
  testcases/kernel/mem/vma/vma02.c                   |   19 +-
  testcases/kernel/mem/vma/vma04.c                   |   11 +-
  testcases/kernel/syscalls/get_mempolicy/Makefile   |    2 +-
  .../syscalls/get_mempolicy/get_mempolicy01.c       |   15 +-
  testcases/kernel/syscalls/mbind/Makefile           |    2 +-
  testcases/kernel/syscalls/mbind/mbind01.c          |   14 +-
  testcases/kernel/syscalls/move_pages/Makefile      |    2 +-
  .../kernel/syscalls/move_pages/move_pages02.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages03.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages04.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages05.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages06.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages07.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages08.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages09.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages10.c      |    5 +-
  .../kernel/syscalls/move_pages/move_pages11.c      |    5 +-
  .../syscalls/move_pages/move_pages_support.c       |    8 +-
  testcases/kernel/syscalls/numa/Makefile            |   22 --
  testcases/kernel/syscalls/numa/Makefile.inc        |   27 --
  testcases/kernel/syscalls/numa/lib/Makefile        |   26 --
  testcases/kernel/syscalls/numa/lib/numa_helper.c   |  165 ------------
  testcases/kernel/syscalls/numa/lib/numa_helper.h   |   33 ---
  46 files changed, 562 insertions(+), 508 deletions(-)

create mode 100644 testcases/kernel/include/lib.mk create mode 100644 testcases/kernel/include/numa_helper.h create mode 100644 testcases/kernel/lib/Makefile
create mode 100644 testcases/kernel/lib/numa_helper.c create mode 100644 testcases/kernel/mem/include/libmem.mk delete mode 100644 testcases/kernel/syscalls/numa/Makefile delete mode 100644 testcases/kernel/syscalls/numa/Makefile.inc delete mode 100644 testcases/kernel/syscalls/numa/lib/Makefile delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.c delete mode 100644 testcases/kernel/syscalls/numa/lib/numa_helper.h

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#25 lore raw
Quoted 34 lines · Caspar Zhang
Quoted 24 lines · Zhouping Liu

Hi,

Quoted 2 lines · Caspar Zhang

Resending the whole patch series (including Jan's 2 patches) for easier reviewing.

Caspar, after applying the patch set, I met the bellow compiling error when do 'make install':

... snip ...
make[4]: Leaving directory `/root/ltp_new/testcases/kernel/syscalls/umask'
make[3]: Leaving directory /root/ltp_new/testcases/kernel/syscalls' make[3]: Entering directory /root/ltp_new/testcases/kernel/lib' ../../../include/mk/env_post.mk:94: warning: overriding recipe for target `/opt/ltp/lib'
../../../include/mk/env_post.mk:94: warning: ignoring old recipe for target `/opt/ltp/lib'
../../../include/mk/env_post.mk:96: warning: overriding recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/env_post.mk:96: warning: ignoring old recipe for target /opt/ltp/lib/libkerntest.a' ../../../include/mk/generic_trunk_target.inc:89: CURDIR is:
/root/ltp_new/testcases/kernel/lib

Quoted 8 lines

../../../include/mk/generic_trunk_target.inc:89: *** SUBDIRS empty -- did you want generic_leaf_target instead?. Stop.
make[3]: Leaving directory `/root/ltp_new/testcases/kernel/lib' make[2]: *** [install] Error 2
make[2]: Leaving directory `/root/ltp_new/testcases/kernel' make[1]: *** [install] Error 2
make[1]: Leaving directory `/root/ltp_new/testcases'
make: *** [testcases-install] Error 2

Quoted 1 line

Thanks for trying the patches out, can you try 4/6 v2?

yes, tested the v2, and I confirmed it fixed such above compiling error.

Thanks,
Zhouping

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#26 lore raw
In reply to Caspar Zhang
Quoted 18 lines · Caspar Zhang

Resending the whole patch series (including Jan's 2 patches) for easier reviewing.

updates:
syscalls/numa: check syscall availability
remove TEST() macro and use syscall() directly.
numa_helper: move to libkerntest
merged the library cleaning fix to this one.
mm: use new numa_helper
the same as previous V3 version, which already has Jan's reivew.

Caspar Zhang (4):
syscalls/numa: check syscall availability
numa_helper: move to libkerntest
mm: use new numa_helper
mm: add common Makefile include: libmem.mk

Quoted 3 lines

Jan Stancek (2):
numa_helper: add flag to get_allowed_nodes() update testcases to use flag for get_allowed_nodes()

As you guys all reviewed and tested this series, and this already flies for weeks, I just pushed this series. Then will run on our test system next week. ;) Thank you guys.

Wanlong Gao

------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list