Skip to contentSkip to conversation

mbind01: dont use hardcoded NUMA node ids

PATCH Superseded Jan Stancek 1 participant 1 message May 29, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 mbind01: dont use hardcoded NUMA node ids

---
 testcases/kernel/syscalls/mbind/Makefile  |    3 +--
 testcases/kernel/syscalls/mbind/mbind01.c |    9 +++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)
testcases/kernel/syscalls/mbind/Makefile +1 -2
index bc50178..932037f 100644
@@ -31,6 +31,5 @@ endif
 
 CPPFLAGS		+= -I$(abs_srcdir)/../utils/
 
-LDLIBS			+= $(NUMA_LIBS)
-
+include $(abs_srcdir)/../numa/Makefile.inc
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/mbind/mbind01.c +7 -2
index 4b25db0..1148324 100644
@@ -63,6 +63,7 @@
 #include "usctest.h"
 #include "linux_syscall_numbers.h"
 #include "include_j_h.h"
+#include "numa_helper.h"
 
 char *TCID = "mbind01";
 int  TST_TOTAL = 2;
@@ -217,15 +218,19 @@ static int do_test(struct test_case *tc)
 	unsigned long maxnode = NUMA_NUM_NODES;
 	unsigned long len = MEM_LENGTH;
 	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);
 
 #if !defined(LIBNUMA_API_VERSION) || LIBNUMA_API_VERSION < 2
 	nodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(nodemask);
-	nodemask_set(nodemask, 0);
+	nodemask_set(nodemask, test_node);
 	getnodemask = malloc(sizeof(nodemask_t));
 	nodemask_zero(getnodemask);
 #else
-	numa_bitmask_setbit(nodemask, 0);
+	numa_bitmask_setbit(nodemask, test_node);
 #endif
 	p = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
 		    0, 0);

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