linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Amit K. Arora" <aarora@linux.vnet.ibm.com>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-numa@vger.kernel.org
Subject: [PATCH] distance table for non-contiguous NUMA nodes
Date: Mon, 9 Mar 2009 18:47:20 +0530	[thread overview]
Message-ID: <20090309131720.GA6250@amitarora.in.ibm.com> (raw)
In-Reply-To: <20090302135836.GB1587@sgi.com>

Hi Cliff,

I am suggesting this new patch, which applies on top of the previous two
(which I think you have already added to 2.0.3-rc2). This patch avoids
showing those NUMA nodes which are unavailable when showing the NUMA
distances too.

So, currently (with previous two patches applied) the NUMA distance
table for non-contiguous NODES looks something like this (assuming
nodes 2 and 3 are not existing) :

node   0   1   2   3   4   5
  0:  10  20   0   0  20  20
  1:  20  10   0   0  20  20
  2:   0   0   0   0   0   0
  3:   0   0   0   0   0   0
  4:  20  20   0   0  10  20
  5:  20  20   0   0  20  10

Please note that for non-existing NODES 2 and 3, a NUMA distance of "0"
is being shown, which doesn't make sense.

Hence I propose this patch which will skip the unavailable nodes (in
this case NODE 2 and 3), while printing the NUMA distances and the
output on the same machine will look something like:

node   0   1   4   5 
  0:  10  20  20  20 
  1:  20  10  20  20 
  4:  20  20  10  20 
  5:  20  20  20  10 


Please find the patch below. Thanks!


Signed-off-by: Amit K Arora <aarora@linux.vnet.ibm.com>

diff -Nuarp numactl-2.0.3-rc2.ORG/numactl.c numactl-2.0.3-rc2/numactl.c
--- numactl-2.0.3-rc2.ORG/numactl.c	2009-03-09 18:43:05.000000000 +0530
+++ numactl-2.0.3-rc2/numactl.c	2009-03-09 18:43:14.000000000 +0530
@@ -187,12 +187,16 @@ static void print_distances(int maxnode)
 	printf("node distances:\n"); 
 	printf("node ");
 	for (i = 0; i <= maxnode; i++) 
-		printf("% 3d ", i);
+		if (numa_bitmask_isbitset(numa_all_nodes_ptr, i))
+			printf("% 3d ", i);
 	printf("\n");
 	for (i = 0; i <= maxnode; i++) {
+		if (!numa_bitmask_isbitset(numa_all_nodes_ptr, i))
+			continue;
 		printf("% 3d: ", i);
-		for (k = 0; k <= maxnode; k++) 
-			printf("% 3d ", numa_distance(i,k)); 
+		for (k = 0; k <= maxnode; k++)
+			if (numa_bitmask_isbitset(numa_all_nodes_ptr, k))
+				printf("% 3d ", numa_distance(i,k)); 
 		printf("\n");
 	}			
 }

--
Regards,
Amit Arora

      reply	other threads:[~2009-03-09 13:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-02 13:05 [PATCH 0/2] non-contiguous NUMA nodes handling in numactl and libnuma Amit K. Arora
2009-03-02 13:19 ` [PATCH 1/2] handle NUMA distances properly for non-contiguous nodes Amit K. Arora
2009-03-02 13:23 ` [PATCH 2/2] ignore unavailable NUMA nodes Amit K. Arora
2009-03-02 13:27 ` Results after applying the patch Amit K. Arora
2009-03-02 13:58 ` [PATCH 0/2] non-contiguous NUMA nodes handling in numactl and libnuma Cliff Wickman
2009-03-09 13:17   ` Amit K. Arora [this message]

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=20090309131720.GA6250@amitarora.in.ibm.com \
    --to=aarora@linux.vnet.ibm.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).