|
|
c88143 |
From 2b190afdbbff875e519e4ae45390bdde11e8e190 Mon Sep 17 00:00:00 2001
|
|
|
c88143 |
From: Harish <harish@linux.vnet.ibm.com>
|
|
|
c88143 |
Date: Wed, 20 Jun 2018 18:46:55 +0530
|
|
|
c88143 |
Subject: [PATCH 2/7] numademo: fix wrong node input
|
|
|
c88143 |
|
|
|
c88143 |
In few sparse node systems, test fails with invalid argument at
|
|
|
c88143 |
set_mempolicy through numa_preferred_node. Patch fixes it by
|
|
|
c88143 |
providing a valid wrong node.
|
|
|
c88143 |
|
|
|
c88143 |
Signed-off-by: Harish <harish@linux.vnet.ibm.com>
|
|
|
c88143 |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
c88143 |
---
|
|
|
c88143 |
numademo.c | 13 ++++++++++---
|
|
|
c88143 |
1 file changed, 10 insertions(+), 3 deletions(-)
|
|
|
c88143 |
|
|
|
c88143 |
diff --git a/numademo.c b/numademo.c
|
|
|
c88143 |
index 90d8e84..4d3c058 100644
|
|
|
c88143 |
--- a/numademo.c
|
|
|
c88143 |
+++ b/numademo.c
|
|
|
c88143 |
@@ -298,7 +298,7 @@ int popcnt(unsigned long val)
|
|
|
c88143 |
|
|
|
c88143 |
int max_node, numnodes;
|
|
|
c88143 |
|
|
|
c88143 |
-void get_node_list()
|
|
|
c88143 |
+int get_node_list()
|
|
|
c88143 |
{
|
|
|
c88143 |
int a, got_nodes = 0;
|
|
|
c88143 |
long free_node_sizes;
|
|
|
c88143 |
@@ -310,6 +310,9 @@ void get_node_list()
|
|
|
c88143 |
if (numa_node_size(a, &free_node_sizes) > 0)
|
|
|
c88143 |
node_to_use[got_nodes++] = a;
|
|
|
c88143 |
}
|
|
|
c88143 |
+ if(got_nodes != numnodes)
|
|
|
c88143 |
+ return -1;
|
|
|
c88143 |
+ return 0;
|
|
|
c88143 |
}
|
|
|
c88143 |
|
|
|
c88143 |
void test(enum test type)
|
|
|
c88143 |
@@ -436,7 +439,7 @@ void test(enum test type)
|
|
|
c88143 |
numa_set_localalloc();
|
|
|
c88143 |
memtest("local allocation", numa_alloc(msize));
|
|
|
c88143 |
|
|
|
c88143 |
- numa_set_preferred((node_to_use[i]+1) % numnodes );
|
|
|
c88143 |
+ numa_set_preferred(node_to_use[(i + 1) % numnodes]);
|
|
|
c88143 |
memtest("setting wrong preferred node", numa_alloc(msize));
|
|
|
c88143 |
numa_set_preferred(node_to_use[i]);
|
|
|
c88143 |
memtest("setting correct preferred node", numa_alloc(msize));
|
|
|
c88143 |
@@ -512,7 +515,11 @@ int main(int ac, char **av)
|
|
|
c88143 |
if (!force)
|
|
|
c88143 |
exit(1);
|
|
|
c88143 |
}
|
|
|
c88143 |
- get_node_list();
|
|
|
c88143 |
+ if(get_node_list()){
|
|
|
c88143 |
+ fprintf(stderr, "Configured Nodes does not match available memory nodes\n");
|
|
|
c88143 |
+ exit(1);
|
|
|
c88143 |
+ }
|
|
|
c88143 |
+
|
|
|
c88143 |
printf("%d nodes available\n", numnodes);
|
|
|
c88143 |
fract_nodes = (((numnodes-1)/8)*2) + FRACT_NODES;
|
|
|
c88143 |
|
|
|
c88143 |
--
|
|
|
c88143 |
2.7.4
|
|
|
c88143 |
|