move_pages: dont use hardcoded NUMA node ids
PATCH v2 4/4 move_pages: dont use hardcoded NUMA node ids
Signed-off-by Jan Stancek <[email protected]>
--- testcases/kernel/syscalls/move_pages/Makefile | 5 +- .../kernel/syscalls/move_pages/move_pages02.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages03.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages04.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages05.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages06.c | 9 +++- .../kernel/syscalls/move_pages/move_pages07.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages08.c | 9 +++- .../kernel/syscalls/move_pages/move_pages09.c | 7 ++- .../kernel/syscalls/move_pages/move_pages10.c | 11 +++-- .../kernel/syscalls/move_pages/move_pages11.c | 11 +++-- .../syscalls/move_pages/move_pages_support.c | 44 ++++++++++++++----- .../syscalls/move_pages/move_pages_support.h | 1 + 13 files changed, 101 insertions(+), 51 deletions(-)
testcases/kernel/syscalls/move_pages/Makefile +2 -3
@@ -22,8 +22,6 @@ include $(top_srcdir)/include/mk/testcases.mk CPPFLAGS += -I$(abs_srcdir)/../utils -LDLIBS += $(NUMA_LIBS) - INSTALL_TARGETS := move_pages.sh MAKE_TARGETS := $(patsubst $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
@@ -35,6 +33,7 @@ move_pages_support.o: CFLAGS += -Wno-unused-function $(MAKE_TARGETS): %: %.o move_pages_support.o -LDLIBS += $(NUMA_LIBS) -lpthread -lrt +LDLIBS += -lpthread -lrt +include $(abs_srcdir)/../numa/Makefile.inc include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/syscalls/move_pages/move_pages02.c +7 -4
@@ -83,15 +83,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;/* reset Tst_count in case we are looping */ Tst_count =0 ;
@@ -156,4 +159,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages03.c +7 -4
@@ -122,15 +122,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;pid_t cpid;sem_t *sem;
@@ -223,4 +226,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages04.c +7 -4
@@ -89,15 +89,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;unsigned long onepage =get_page_size ();/* reset Tst_count in case we are looping */
@@ -175,4 +178,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages05.c +7 -4
@@ -123,15 +123,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[N_TEST_PAGES ] = {0 };int nodes[N_TEST_PAGES ];int status[N_TEST_PAGES ]; -int ret;pid_t cpid;sem_t *sem;
@@ -237,4 +240,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages06.c +6 -3
@@ -83,15 +83,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; +unsigned int from_node;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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;/* reset Tst_count in case we are looping */ Tst_count =0 ;
@@ -152,4 +155,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages07.c +7 -4
@@ -83,15 +83,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;int ipid;/* reset Tst_count in case we are looping */
@@ -163,4 +166,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages08.c +6 -3
@@ -81,15 +81,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;/* reset Tst_count in case we are looping */ Tst_count =0 ;
testcases/kernel/syscalls/move_pages/move_pages09.c +5 -2
@@ -81,14 +81,17 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;/* reset Tst_count in case we are looping */ Tst_count =0 ;
testcases/kernel/syscalls/move_pages/move_pages10.c +7 -4
@@ -83,15 +83,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;/* reset Tst_count in case we are looping */ Tst_count =0 ;
@@ -151,4 +154,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages11.c +7 -4
@@ -122,15 +122,18 @@ int main(int argc, char **argv)#if HAVE_NUMA_MOVE_PAGES unsigned int i;int lc;/* loop counter */ -unsigned int from_node =0 ; -unsigned int to_node =1 ; +unsigned int from_node; +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);/* check for looping state if -i option is given */ for (lc =0 ;TEST_LOOPING (lc); lc++) {void *pages[TEST_PAGES ] = {0 };int nodes[TEST_PAGES ];int status[TEST_PAGES ]; -int ret;pid_t cpid;sem_t *sem;
@@ -241,4 +244,4 @@ void cleanup(void)*/ TEST_CLEANUP ; - } + }
testcases/kernel/syscalls/move_pages/move_pages_support.c +32 -12
82 lines not on this page · raw message
testcases/kernel/syscalls/move_pages/move_pages_support.h +1 -0
@@ -27,6 +27,7 @@#include <numaif.h> #endif #include <semaphore.h> +#include "numa_helper.h" long get_page_size ();
------------------------------------------------------------------------------
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