linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: Cliff Wickman <cpi@sgi.com>
Cc: Kornilios Kourtis <kkourt@cslab.ece.ntua.gr>,
	Brice Goglin <Brice.Goglin@inria.fr>,
	linux-numa@vger.kernel.org, eric.whitney@hp.com
Subject: [PATCH 5/8] numactl/libnuma - fix parsing of cpu, node mask
Date: Tue, 28 Apr 2009 12:36:50 -0400	[thread overview]
Message-ID: <20090428163650.24945.94082.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20090428163621.24945.95516.sendpatchset@localhost.localdomain>

[PATCH 05/08] - Fix Parsing of maxproc{cpu|node} in set_thread_constraints()

Against:  numactl-2.0.3-rc2

NOTE:  a patch to fix this has already been posted to linux-numa by
Brice Goglin.  This is the version that I had in my tree.

Hard-coded '+15' was dropping the first character of the mask.
This caused, e.g., numactl to error out on last 4 processors of a
platform--on a 32-cpu system, in my case.

That's a tab separating the tag from the mask, so look for tab
explicitly.

 libnuma.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Index: numactl-2.0.3-rc2/libnuma.c
===================================================================
--- numactl-2.0.3-rc2.orig/libnuma.c	2009-02-13 11:17:57.000000000 -0500
+++ numactl-2.0.3-rc2/libnuma.c	2009-02-13 11:32:35.000000000 -0500
@@ -373,6 +373,9 @@ read_mask(char *s, struct bitmask *bmp)
 	unsigned int *start = tmp;
 	unsigned int i, n = 0, m = 0;
 
+	if (!s)
+		return 0;	/* shouldn't happen */
+
 	i = strtoul(s, &end, 16);
 
 	/* Skip leading zeros */
@@ -445,12 +448,15 @@ set_thread_constraints(void)
 	}
 
 	while (getline(&buffer, &buflen, f) > 0) {
+		/* mask starts after [last] tab */
+		char  *mask = strrchr(buffer,'\t') + 1;
+
 		if (strncmp(buffer,"Cpus_allowed:",13) == 0)
-			maxproccpu = read_mask(buffer + 15, numa_all_cpus_ptr);
+			maxproccpu = read_mask(mask, numa_all_cpus_ptr);
 
 		if (strncmp(buffer,"Mems_allowed:",13) == 0) {
 			maxprocnode =
-				read_mask(buffer + 15, numa_all_nodes_ptr);
+				read_mask(mask, numa_all_nodes_ptr);
 		}
 	}
 	fclose(f);

  parent reply	other threads:[~2009-04-28 16:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-28 16:36 [PATCH 0/8] numactl/libnuma - Fixes and Cleanup Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 1/8] numactl/libnuma - Possibly already fixed leaks and cleanup Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 2/8] numactl/libnuma - Simple bitmask leak fixes Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 3/8] numactl/libnuma - more " Lee Schermerhorn
2009-04-28 16:36 ` [PATCH 4/8] numactl/libnuma - return freeable bitmasks Lee Schermerhorn
2009-04-28 16:36 ` Lee Schermerhorn [this message]
2009-04-28 16:36 ` [PATCH 6/8] numactl/numademo - eliminate page allocation overhead from memtest measurements Lee Schermerhorn
2009-04-28 16:37 ` [PATCH 7/8] numactl/Makefile - Generalize Makefile .so Version Lee Schermerhorn
2009-04-28 16:46   ` Andi Kleen
2009-04-28 17:01     ` Lee Schermerhorn
2009-04-28 17:10       ` Andi Kleen
2009-04-28 16:37 ` [PATCH 8/8] numactl/test - Make checkaffinity more robust Lee Schermerhorn
2009-04-28 19:38 ` [PATCH 0/8] numactl/libnuma - Fixes and Cleanup Cliff Wickman
2009-04-28 20:08   ` Lee Schermerhorn

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=20090428163650.24945.94082.sendpatchset@localhost.localdomain \
    --to=lee.schermerhorn@hp.com \
    --cc=Brice.Goglin@inria.fr \
    --cc=cpi@sgi.com \
    --cc=eric.whitney@hp.com \
    --cc=kkourt@cslab.ece.ntua.gr \
    --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).