From: Petr Holasek <pholasek@redhat.com>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-numa@vger.kernel.org, Petr Holasek <pholasek@redhat.com>
Subject: [PATCH] numactl: Show distance info even for machines without 0th node.
Date: Tue, 11 Sep 2012 11:20:27 +0200 [thread overview]
Message-ID: <1347355227-2280-1-git-send-email-pholasek@redhat.com> (raw)
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@redhat.com>
---
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
reply other threads:[~2012-09-11 9:20 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=1347355227-2280-1-git-send-email-pholasek@redhat.com \
--to=pholasek@redhat.com \
--cc=cpw@sgi.com \
--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).