Kazunori Asayama | 9 Jan 2009 13:23
Picon
Picon

Unexpected warning on non-NUMA host

Hi all,

When I ran a program which was linked with libnuma (version 2.0.2) but
without libnuma function calls on non-NUMA platform, I got an unexpected
warning message:

> libnuma: Warning: /sys not mounted or no numa system. Assuming one
node: No such file or directory

I'd like to create single program which works on both of NUMA and
non-NUMA platforms, by switching behavior according to the result of
numa_available(). So I expect the message above isn't displayed if no
NUMA library function except numa_available() is called, even if the
program is linked with libnuma.

AFAIK, the version 1 didn't show such message until a NUMA function
except numa_available() was called.

So is the current behavior unexpected?

Regards,
--

-- 
(ASAYAMA Kazunori
  (asayama <at> sm.sony.co.jp))
t
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Cliff Wickman | 9 Jan 2009 16:15
Picon
Favicon

Re: Unexpected warning on non-NUMA host

Asayama,

On Fri, Jan 09, 2009 at 09:23:09PM +0900, Kazunori Asayama wrote:
> Hi all,
> 
> When I ran a program which was linked with libnuma (version 2.0.2) but
> without libnuma function calls on non-NUMA platform, I got an unexpected
> warning message:
> 
> > libnuma: Warning: /sys not mounted or no numa system. Assuming one
> node: No such file or directory
> 
> I'd like to create single program which works on both of NUMA and
> non-NUMA platforms, by switching behavior according to the result of
> numa_available(). So I expect the message above isn't displayed if no
> NUMA library function except numa_available() is called, even if the
> program is linked with libnuma.
> 
> AFAIK, the version 1 didn't show such message until a NUMA function
> except numa_available() was called.
> 
> So is the current behavior unexpected?

libnuma's initialization attempts determine the size of everything
(configured nodes, nodemask size, max cpus, configured cpus, cpu
and node constraints of the current thread)

In doing so, it emits the warning you see if it cannot open
/sys/devices/system/node.
It sets  maxconfigurednode = 0
(Continue reading)

Andi Kleen | 10 Jan 2009 06:49

[PATCH] Fix numactl test program includes


The .. paths in test includes are useless because the Makefile
compiles them from toplevel anyways. Also this allows to build
them outside the numactl tree as examples.

Signed-off-by: Andi Kleen <ak <at> linux.intel.com>

diff -urp numactl-2.0.2/test/mbind_mig_pages.c numactl-2.0.2-hack//test/mbind_mig_pages.c
--- numactl-2.0.2/test/mbind_mig_pages.c	2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.2-hack//test/mbind_mig_pages.c	2009-01-10 06:26:54.000000000 +0100
 <at>  <at>  -6,8 +6,8  <at>  <at> 
  */
 #include <stdio.h>
 #include <stdlib.h>
-#include "../numa.h"
-#include "../numaif.h"
+#include <numa.h>
+#include <numaif.h>
 #include <unistd.h>
 #include <asm/unistd.h>

diff -urp numactl-2.0.2/test/migrate_pages.c numactl-2.0.2-hack//test/migrate_pages.c
--- numactl-2.0.2/test/migrate_pages.c	2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.2-hack//test/migrate_pages.c	2009-01-10 06:27:33.000000000 +0100
 <at>  <at>  -6,7 +6,7  <at>  <at> 
  */
 #include <stdio.h>
 #include <stdlib.h>
-#include "../numa.h"
+#include <numa.h>
(Continue reading)

Andi Kleen | 10 Jan 2009 06:51

[PATCH] Fix mbind_migrate_pages


The nodemask conversion of mbind_mig_pages had some off by one
bugs, making the program always fail on 2 node systems.

Noticed by Jay Weinstein.

Signed-off-by: Andi Kleen <ak <at> linux.intel.com>

diff -urp numactl-2.0.2/test/mbind_mig_pages.c numactl-2.0.2-hack//test/mbind_mig_pages.c
--- numactl-2.0.2/test/mbind_mig_pages.c	2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.2-hack//test/mbind_mig_pages.c	2009-01-10 06:26:54.000000000 +0100
 <at>  <at>  -91,7 +91,7  <at>  <at>  int main(int argc, char **argv)
 	/* Move to node zero */
 	printf("\nMoving pages via mbind to node 0 ...\n");
 	rc = mbind(pages, page_count * pagesize, MPOL_BIND, old_nodes->maskp,
-		old_nodes->size, MPOL_MF_MOVE | MPOL_MF_STRICT);
+		old_nodes->size + 1, MPOL_MF_MOVE | MPOL_MF_STRICT);
 	if (rc < 0) {
 		perror("mbind");
 		errors++;
 <at>  <at>  -100,7 +100,7  <at>  <at>  int main(int argc, char **argv)

 	printf("\nMoving pages via mbind from node 0 to 1 ...\n");
 	rc = mbind(pages, page_count * pagesize, MPOL_BIND, new_nodes->maskp,
-		new_nodes->size, MPOL_MF_MOVE | MPOL_MF_STRICT);
+		new_nodes->size + 1, MPOL_MF_MOVE | MPOL_MF_STRICT);
 	if (rc < 0) {
 		perror("mbind");
 		errors++;
 	
(Continue reading)

Andi Kleen | 10 Jan 2009 06:54

[PATCH] Fix test/prefered

Fix test/prefered

Couple of bugs here:

- First the kernel errors out of the nodemask is < MAXNUMNODES,
so have to discover that at runtime. There's no function
in libnuma for this (perhaps there should be one?), so i
wrote one here.
- The loop set the node in the wrong mask, breaking the test

Signed-off-by: Andi Kleen <ak <at> linux.intel.com>

diff -urp numactl-2.0.2/test/prefered.c numactl-2.0.2-hack//test/prefered.c
--- numactl-2.0.2/test/prefered.c	2008-08-05 16:36:58.000000000 +0200
+++ numactl-2.0.2-hack//test/prefered.c	2009-01-10 06:30:11.000000000 +0100
 <at>  <at>  -6,20 +6,38  <at>  <at> 
 #include <assert.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>

 #define err(x) perror(x),exit(1)

+/* Discover MAX_NUMNODE of the kernel */
+int max_numnode(void)
+{	
+	int v;
+	unsigned size = 128;
+	struct bitmask *mask = numa_bitmask_alloc(size);
+	while (get_mempolicy(NULL, mask->maskp, mask->size, &v, MPOL_F_ADDR) < 0 &&
(Continue reading)

Andi Kleen | 10 Jan 2009 07:18

[PATCH] Fix test/prefered v2

> Fix test/prefered
> 
> Couple of bugs here:
> 
> - First the kernel errors out of the nodemask is < MAXNUMNODES,
> so have to discover that at runtime. There's no function
> in libnuma for this (perhaps there should be one?), so i
> wrote one here.
> - The loop set the node in the wrong mask, breaking the test

Sorry that was the broken version, here's a v2 with a actually
working max_numnode. The older version happened to work
on my test system, but was obviously not correct.

---

Fix test/prefered v2

Couple of bugs here:

- First the kernel errors out of the nodemask is < MAXNUMNODES,
so have to discover that at runtime. There's no function
in libnuma for this (perhaps there should be one?), so i
wrote one here.
- The loop set the node in the wrong mask, breaking the test

v2: Correct max_numnode detection

Signed-off-by: Andi Kleen <ak <at> linux.intel.com>

(Continue reading)

Kazunori Asayama | 13 Jan 2009 02:57
Picon
Picon

Re: Unexpected warning on non-NUMA host

Cliff,

Cliff Wickman wrote:
> In doing so, it emits the warning you see if it cannot open
> /sys/devices/system/node.
> It sets  maxconfigurednode = 0
> Perhaps it shouldn't complain, but just go on quietly to avoid
> the noise on a non-NUMA platform.
> 
> Any objection?

Sounds good for me.

Thanks,
--

-- 
(Kazunori Asayama
  (asayama <at> sm.sony.co.jp))
t
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Bernhard Walle | 14 Jan 2009 13:59
Picon

[PATCH] Remove numa_maps(5)

Since the manpage is maintained in the Linux manpages tree now, we don't need
it in numactl any more. In fact, it just adds file conflicts to distributor's
packages.

Signed-off-by: Bernhard Walle <bwalle <at> suse.de>

2 files changed, 109 deletions(-)
Makefile    |    1 
numa_maps.5 |  108 -----------------------------------------------------------

Attachment (numactl-2.0.3-rc1.patch): text/x-patch, 4372 bytes
Cliff Wickman | 14 Jan 2009 15:23
Picon
Favicon

Re: Unexpected warning on non-NUMA host

On Tue, Jan 13, 2009 at 10:57:53AM +0900, Kazunori Asayama wrote:
> Cliff,
> 
> Cliff Wickman wrote:
> > In doing so, it emits the warning you see if it cannot open
> > /sys/devices/system/node.
> > It sets  maxconfigurednode = 0
> > Perhaps it shouldn't complain, but just go on quietly to avoid
> > the noise on a non-NUMA platform.
> > 
> > Any objection?
> 
> Sounds good for me.

That change is in the numactl-2.0.3-rc1.tar.gz

There will be more changes soon, as Andi and Bernhard have posted some
patches that I haven't gotten to yet.

-Cliff
--

-- 
Cliff Wickman
Silicon Graphics, Inc.
cpw <at> sgi.com
(651) 683-3824
--
To unsubscribe from this list: send the line "unsubscribe linux-numa" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

(Continue reading)

Cliff Wickman | 15 Jan 2009 16:18
Picon
Favicon

Re: [PATCH] Fix test/prefered v2


Hi Andi,

> Date: Sat, 10 Jan 2009 07:18:09 +0100
> From: Andi Kleen <andi <at> firstfloor.org>
> To: Andi Kleen <andi <at> firstfloor.org>
> Cc: cpw <at> sgi.com, linux-numa <at> vger.kernel.org
> Subject: [PATCH] Fix test/prefered v2
> 
> Fix test/prefered v2
>  
> Couple of bugs here:
>  
> - First the kernel errors out of the nodemask is < MAXNUMNODES,
> so have to discover that at runtime. There's no function
> in libnuma for this (perhaps there should be one?), so i
> wrote one here.

There is numa_num_possible_nodes(). It determines the size of
the kernel nodemask_t (MAX_NUMNODES) by counting the size of Mems_allowed:
in /proc/self/status. (And if that is not available, falls back to a
procedure very similar to your max_numnode().)
The patch, but using numa_num_possible_nodes() is below.
It returns the same results, in my tests.

Is there some subtle difference between numa_num_possible_nodes() and
your function that I'm missing?

-Cliff

(Continue reading)


Gmane