|
|
c88143 |
From c465ca7ca41aa03e755ed71fa0281c620b0d8dc0 Mon Sep 17 00:00:00 2001
|
|
|
c88143 |
From: Harish <harish@linux.vnet.ibm.com>
|
|
|
c88143 |
Date: Thu, 21 Jun 2018 17:22:36 +0530
|
|
|
c88143 |
Subject: [PATCH 3/7] Fix: distance test to include all existing nodes
|
|
|
c88143 |
|
|
|
c88143 |
The previous implementation did not consider memory-less nodes as
|
|
|
c88143 |
numa_num_configured_nodes() returns only nodes with memory and
|
|
|
c88143 |
numa_node_size() check is unnecessary for distance check. Hence
|
|
|
c88143 |
removed the check for memory.
|
|
|
c88143 |
|
|
|
c88143 |
Signed-off-by: Harish <harish@linux.vnet.ibm.com>
|
|
|
c88143 |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
c88143 |
---
|
|
|
c88143 |
test/distance.c | 11 +++++------
|
|
|
c88143 |
1 file changed, 5 insertions(+), 6 deletions(-)
|
|
|
c88143 |
|
|
|
c88143 |
diff --git a/test/distance.c b/test/distance.c
|
|
|
c88143 |
index fca109f..3471db6 100644
|
|
|
c88143 |
--- a/test/distance.c
|
|
|
c88143 |
+++ b/test/distance.c
|
|
|
c88143 |
@@ -5,21 +5,20 @@
|
|
|
c88143 |
|
|
|
c88143 |
int main(void)
|
|
|
c88143 |
{
|
|
|
c88143 |
- int numnodes, maxnode, a, b, got_nodes = 0;
|
|
|
c88143 |
+ int maxnode, a, b, got_nodes = 0;
|
|
|
c88143 |
int *node_to_use;
|
|
|
c88143 |
- long size, free_node_sizes;
|
|
|
c88143 |
if (numa_available() < 0) {
|
|
|
c88143 |
printf("no numa support in kernel\n");
|
|
|
c88143 |
exit(1);
|
|
|
c88143 |
}
|
|
|
c88143 |
- numnodes = numa_num_configured_nodes();
|
|
|
c88143 |
maxnode = numa_max_node();
|
|
|
c88143 |
- node_to_use = (int *)malloc(numnodes * sizeof(int));
|
|
|
c88143 |
+ node_to_use = (int *)malloc(maxnode * sizeof(int));
|
|
|
c88143 |
for (a = 0; a <= maxnode; a++) {
|
|
|
c88143 |
- size = numa_node_size(a, &free_node_sizes);
|
|
|
c88143 |
- if(size != -1)
|
|
|
c88143 |
+ if (numa_bitmask_isbitset(numa_nodes_ptr, a)){
|
|
|
c88143 |
node_to_use[got_nodes++] = a;
|
|
|
c88143 |
+ }
|
|
|
c88143 |
}
|
|
|
c88143 |
+
|
|
|
c88143 |
for (a = 0; a < got_nodes; a++){
|
|
|
c88143 |
printf("%03d: ", node_to_use[a]);
|
|
|
c88143 |
if (numa_distance(node_to_use[a], node_to_use[a]) != 10) {
|
|
|
c88143 |
--
|
|
|
c88143 |
2.7.4
|
|
|
c88143 |
|