linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thierry Fauck <tfauck@free.fr>
To: linux-numa@vger.kernel.org
Cc: ianw@debian.org, hannsj_uhl@de.ibm.com, tfauck@free.fr
Subject: [PATCH] Subject: [PATCH] /sys not mounted on non sequential cpus list
Date: Thu, 19 Nov 2015 12:41:16 +0100	[thread overview]
Message-ID: <1447933276-18804-1-git-send-email-tfauck@free.fr> (raw)

	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@free.fr>

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

                 reply	other threads:[~2015-11-19 11:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447933276-18804-1-git-send-email-tfauck@free.fr \
    --to=tfauck@free.fr \
    --cc=hannsj_uhl@de.ibm.com \
    --cc=ianw@debian.org \
    --cc=linux-numa@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).