[PATCH] Subject: [PATCH] /sys not mounted on non sequential cpus list

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

 



	On multiple node systems like ppc64, node numbers are not sequentials
	and an error message libnuma: Warning: /sys not mounted or invalid
	appears when looking for secondary nodes.
	and cpu numbers are n necessarily sequential, or node numbers
.
---
 libnuma.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

Signed-off-by: Thierry Fauck <tfauck@xxxxxxx>

diff --git a/libnuma.c b/libnuma.c
index 091261c..d8f771a 100644
--- a/libnuma.c
+++ b/libnuma.c
@@ -1274,11 +1274,13 @@ numa_node_to_cpus_v1(int node, unsigned long *buffer, int bufferlen)
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node);
 	f = fopen(fn, "r");
 	if (!f || getdelim(&line, &len, '\n', f) < 1) {
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno));
-		numa_warn(W_nosysfs2,
-		   "(cannot open or correctly parse %s)", fn);
+		if (f) {
+		   numa_warn(W_nosysfs2,
+		      "/sys not mounted or invalid. Assuming one node: %s",
+			     strerror(errno));
+		   numa_warn(W_nosysfs2,
+		      "(cannot open or correctly parse %s)", fn);
+		}
 		bitmask.maskp = (unsigned long *)mask;
 		bitmask.size  = buflen_needed * 8;
 		numa_bitmask_setall(&bitmask);
@@ -1353,11 +1355,13 @@ numa_node_to_cpus_v2(int node, struct bitmask *buffer)
 	sprintf(fn, "/sys/devices/system/node/node%d/cpumap", node); 
 	f = fopen(fn, "r"); 
 	if (!f || getdelim(&line, &len, '\n', f) < 1) { 
-		numa_warn(W_nosysfs2,
-		   "/sys not mounted or invalid. Assuming one node: %s",
-			  strerror(errno)); 
-		numa_warn(W_nosysfs2,
-		   "(cannot open or correctly parse %s)", fn);
+		if (f) {
+		   numa_warn(W_nosysfs2,
+		      "/sys not mounted or invalid. Assuming one node: %s",
+			     strerror(errno)); 
+		   numa_warn(W_nosysfs2,
+		      "(cannot open or correctly parse %s)", fn);
+		}
 		numa_bitmask_setall(mask);
 		err = -1;
 	} 
-- 
1.8.3.1

--
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