Date: Tue, 27 Jul 2010 08:53:25 +0200
From: Andi Kleen <andi@firstfloor.org>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-numa@vger.kernel.org
Subject: Re: libnuma/numactl 2.0.4 release announced

On Mon, Jul 26, 2010 at 05:29:21PM -0500, Cliff Wickman wrote:
> libnuma/numactl release 2.0.4 was announced today on freshmeat.net.

I actually found a bug now (looks like exactly one day too late, 
how it goes). 

The new code does not correct for the -1 quirk in the kernel API for node 
masks, unlike the v1 code did. So the last bit in the node masks is going to 
be missed.

-Andi

---
 libnuma.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Index: numactl-dev/libnuma.c
===================================================================
--- numactl-dev.orig/libnuma.c
+++ numactl-dev/libnuma.c
@@ -258,19 +258,19 @@ WEAK void numa_warn(int num, char *fmt,
 
 static void setpol(int policy, struct bitmask *bmp)
 { 
-	if (set_mempolicy(policy, bmp->maskp, bmp->size) < 0)
+	if (set_mempolicy(policy, bmp->maskp, bmp->size + 1) < 0)
 		numa_error("set_mempolicy");
 } 
 
 static void getpol(int *oldpolicy, struct bitmask *bmp)
 { 
-	if (get_mempolicy(oldpolicy, bmp->maskp, bmp->size, 0, 0) < 0)
+	if (get_mempolicy(oldpolicy, bmp->maskp, bmp->size + 1, 0, 0) < 0)
 		numa_error("get_mempolicy");
 } 
 
 static void dombind(void *mem, size_t size, int pol, struct bitmask *bmp)
 { 
-	if (mbind(mem, size, pol, bmp ? bmp->maskp : NULL, bmp ? bmp->size : 0, 
+	if (mbind(mem, size, pol, bmp ? bmp->maskp : NULL, bmp ? bmp->size + 1 : 0,
 		  mbind_flags) < 0)
 		numa_error("mbind"); 
 } 
