All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-numa@vger.kernel.org, hannsj_uhl@de.ibm.com, wmb@us.ibm.com
Subject: [PATCH] fix output of numactl --hardware with >BITS_PER_LONG cpus
Date: Wed, 28 Jan 2009 17:41:16 +0100	[thread overview]
Message-ID: <200901281741.17419.arnd@arndb.de> (raw)

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@arndb.de>

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');
 }
 

                 reply	other threads:[~2009-01-28 16: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=200901281741.17419.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=cpw@sgi.com \
    --cc=hannsj_uhl@de.ibm.com \
    --cc=linux-numa@vger.kernel.org \
    --cc=wmb@us.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.