[PATCH] fix output of numactl --hardware with >BITS_PER_LONG cpus

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

 



There was evidently a glitch in the conversion of numactl to libnuma2:

The print_node_cpus function tries to find the size of the bitmask,
which it no longer needs to. This results in printing only the
first word of the CPU mask.

This fixes the function to print all available CPUs again.

Found by Bill Buros on a 128-way 64 bit system.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>

diff --git a/numactl.c b/numactl.c
index 2de33d8..f1a7166 100644
--- a/numactl.c
+++ b/numactl.c
@@ -199,28 +199,16 @@ static void print_distances(int maxnode)
 
 void print_node_cpus(int node)
 {
-	int len = 1;
 	int conf_cpus = numa_num_configured_cpus();
+	int i, err;
+	struct bitmask *cpus;
 
-	for (;;) { 
-		int i, err;
-		struct bitmask *cpus;
-
-		cpus = numa_bitmask_alloc(conf_cpus);
-		errno = 0;
-		err = numa_node_to_cpus(node, cpus);
-		if (err < 0) {
-			if (errno == ERANGE) {
-				len *= 2; 
-				continue;
-			}
-			break; 
-		}
-		for (i = 0; i < len*BITS_PER_LONG; i++) 
+	cpus = numa_bitmask_alloc(conf_cpus);
+	err = numa_node_to_cpus(node, cpus);
+	if (err >= 0) 
+		for (i = 0; i < conf_cpus; i++) 
 			if (numa_bitmask_isbitset(cpus, i))
 				printf(" %d", i);
-		break;
-	}
 	putchar('\n');
 }
 
--
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