[PATCH] numactl: Show distance info even for machines without 0th node.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch fixes hardcoded requirement for installed node 0 on machine.
Now numactl -H call fails only when there is no entry in distance table
at all.

Signed-off-by: Petr Holasek <pholasek@xxxxxxxxxx>
---
 numactl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/numactl.c b/numactl.c
index 047a6d0..339f670 100755
--- a/numactl.c
+++ b/numactl.c
@@ -186,8 +186,14 @@ char *fmt_mem(unsigned long long mem, char *buf)
 static void print_distances(int maxnode)
 {
 	int i,k;
+	int fst = 0;
 
-	if (numa_distance(maxnode,0) == 0) {
+	for (i = 0; i <= maxnode; i++)
+		if (numa_bitmask_isbitset(numa_nodes_ptr, i)) {
+			fst = i;
+			break;
+		}
+	if (numa_distance(maxnode,fst) == 0) {
 		printf("No distance information available.\n");
 		return;
 	}
-- 
1.7.11.4

--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [Devices]

  Powered by Linux