linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* numa_get_mems_allowed bug
@ 2010-11-27  3:24 Michael Spiegel
  2010-11-29 19:19 ` Michael Spiegel
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Spiegel @ 2010-11-27  3:24 UTC (permalink / raw)
  To: linux-numa

Happy Thanksgiving to all.  It appears that numa_get_mems_allowed()
does not use the MPOL_F_MEMS_ALLOWED flag.  The return value I receive
when calling this function is an empty nodemask.  I've put together a
hack that uses MPOL_F_MEMS_ALLOWED, and I get the correct nodemask.
The hack I put together does not do the proper error checking that is
performed by getpol().  I'm not sure what is the best patch to fix the
issue.  Perhaps add a third argument to getpol() that accepts an
unsigned long flag?

Cheers,
--Michael

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: numa_get_mems_allowed bug
  2010-11-27  3:24 numa_get_mems_allowed bug Michael Spiegel
@ 2010-11-29 19:19 ` Michael Spiegel
  2010-11-29 19:35   ` Andi Kleen
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Spiegel @ 2010-11-29 19:19 UTC (permalink / raw)
  To: linux-numa

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

To stimulate some discussion, here is the patch file for the issue.
It does the appropriate error checking.  The patch does not use
getpol(), my question was whether it should call the function or not.

--Michael

On Fri, Nov 26, 2010 at 10:24 PM, Michael Spiegel
<michael.m.spiegel@gmail.com> wrote:
> Happy Thanksgiving to all.  It appears that numa_get_mems_allowed()
> does not use the MPOL_F_MEMS_ALLOWED flag.  The return value I receive
> when calling this function is an empty nodemask.  I've put together a
> hack that uses MPOL_F_MEMS_ALLOWED, and I get the correct nodemask.
> The hack I put together does not do the proper error checking that is
> performed by getpol().  I'm not sure what is the best patch to fix the
> issue.  Perhaps add a third argument to getpol() that accepts an
> unsigned long flag?
>
> Cheers,
> --Michael
>

[-- Attachment #2: numactl-mems-allowed.patch --]
[-- Type: application/octet-stream, Size: 518 bytes --]

diff -ru numactl-2.0.6-rc3-clean/libnuma.c numactl-2.0.6-rc3/libnuma.c
--- numactl-2.0.6-rc3-clean/libnuma.c	2010-10-07 09:23:51.000000000 -0400
+++ numactl-2.0.6-rc3/libnuma.c	2010-11-29 14:13:56.823538600 -0500
@@ -1136,7 +1136,9 @@
 	 * can change, so query on each call.
 	 */
 	bmp = numa_allocate_nodemask();
-	getpol(NULL,  bmp);
+	if (get_mempolicy(NULL, bmp->maskp, bmp->size + 1, 0,
+				MPOL_F_MEMS_ALLOWED) < 0)
+		numa_error("get_mempolicy");
 	return bmp;
 }
 make_internal_alias(numa_get_mems_allowed);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: numa_get_mems_allowed bug
  2010-11-29 19:19 ` Michael Spiegel
@ 2010-11-29 19:35   ` Andi Kleen
  2010-11-29 21:09     ` Cliff Wickman
  0 siblings, 1 reply; 4+ messages in thread
From: Andi Kleen @ 2010-11-29 19:35 UTC (permalink / raw)
  To: Michael Spiegel; +Cc: linux-numa

On Mon, Nov 29, 2010 at 02:19:29PM -0500, Michael Spiegel wrote:
> To stimulate some discussion, here is the patch file for the issue.
> It does the appropriate error checking.  The patch does not use
> getpol(), my question was whether it should call the function or not.

Patch looks good to me. getpol() is just a utility function.
-Andi

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: numa_get_mems_allowed bug
  2010-11-29 19:35   ` Andi Kleen
@ 2010-11-29 21:09     ` Cliff Wickman
  0 siblings, 0 replies; 4+ messages in thread
From: Cliff Wickman @ 2010-11-29 21:09 UTC (permalink / raw)
  To: michael.m.spiegel; +Cc: andi, linux-numa

On Mon, Nov 29, 2010 at 08:35:11PM +0100, Andi Kleen wrote:
> On Mon, Nov 29, 2010 at 02:19:29PM -0500, Michael Spiegel wrote:
> > To stimulate some discussion, here is the patch file for the issue.
> > It does the appropriate error checking.  The patch does not use
> > getpol(), my question was whether it should call the function or not.
> 
> Patch looks good to me. getpol() is just a utility function.
> -Andi

Okay, thanks for the patch Michael.   And Andi's review.

It's rolled into ftp://oss.sgi.com/www/projects/libnuma/download/
    numactl-2.0.6-rc4.tar.gz

Version 2.0.6 is awaiting a new feature from Andi.  It includes Tim
Pepper's fixes.  See the CHANGES file for a list.

-Cliff
-- 
Cliff Wickman
SGI
cpw@sgi.com
(651) 683-3824

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-29 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-27  3:24 numa_get_mems_allowed bug Michael Spiegel
2010-11-29 19:19 ` Michael Spiegel
2010-11-29 19:35   ` Andi Kleen
2010-11-29 21:09     ` Cliff Wickman

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).