linux-numa.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cliff Wickman <cpw@sgi.com>
To: Brice Goglin <Brice.Goglin@inria.fr>
Cc: linux-numa@vger.kernel.org, ianw@debian.org
Subject: Re: wrong parsing to /proc/self/status causes wrong out-of-range errors
Date: Thu, 23 Apr 2009 08:55:40 -0500	[thread overview]
Message-ID: <20090423135540.GA20320@sgi.com> (raw)
In-Reply-To: <49EDEAC2.6040400@inria.fr>

Hi Brice,

Thanks for the fix.

I tested it on ia64.
It is now part of numactl-2.0.3-rc2.tar.gz at
ftp://oss.sgi.com/www/projects/libnuma/download/

BTW,
Andi, Lee and all,
We have no established release schedule that I'm aware of.
2.0.2 was Aug08
There are about 14 fixes accumulated in 2.0.3 rc1 and rc2.  But only
a trickle of small changes lately.
I'm inclined to announce it as 2.0.3, if you have used it and are
satisfied that it's stable.

-Cliff

On Tue, Apr 21, 2009 at 05:48:18PM +0200, Brice Goglin wrote:
> Hello,
> 
> After upgrading a quad-socket quad-core machine from 2.6.27 to 2.6.29,
> numactl now reports that --physcpubind=X is an out-of-range CPU when
> 12<=X<16
> (while obviously we still have 16 cores in this machine).
> Same problem on other machines with 2.6.29: the last 4 cores are
> "out-of-range".
> First observed with Debian's 2.0.3-rc1 but seems to occur with 2.0.3-rc2
> as well.
> 
> It appears that this is caused by set_thread_constraints() passing a
> wrong pointer to read_mask() when trying to gather maxproccpu and
> maxprocnode from /proc/self/status. It points to the second character
> of the mask instead of the first one, thus loosing one "f", which means
> 4 cores are lost.
> 
> The kernel code generating the "Cpus_allowed:" and "Mems_allowed:" masks
> in /proc/self/status has changed recently, so maybe the formatting
> changed a bit (whitespaces?).
> 
> The patch below fixes this problem by just passing a pointer to the first
> character after ":". read_mask/strtoul are able to skip whitespaces anyway,
> so no need to bother trying to guess how many whitespaces follow ":" in the
> caller.
> 
> Brice
> 
> 
> Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
> 
> diff -ur numactl-2.0.3~rc1/libnuma.c numactl-2.0.3~rc1.save/libnuma.c
> --- numactl-2.0.3~rc1/libnuma.c	2008-12-09 20:38:07.000000000 +0100
> +++ numactl-2.0.3~rc1.save/libnuma.c	2009-04-21 15:44:19.000000000 +0200
> @@ -479,11 +479,11 @@
>  
>  	while (getline(&buffer, &buflen, f) > 0) {
>  		if (strncmp(buffer,"Cpus_allowed:",13) == 0)
> -			maxproccpu = read_mask(buffer + 15, numa_all_cpus_ptr);
> +			maxproccpu = read_mask(buffer + 13, numa_all_cpus_ptr);
>  
>  		if (strncmp(buffer,"Mems_allowed:",13) == 0) {
>  			maxprocnode =
> -				read_mask(buffer + 15, numa_all_nodes_ptr);
> +				read_mask(buffer + 13, numa_all_nodes_ptr);
>  		}
>  	}
>  	fclose(f);
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-numa" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Cliff Wickman
Silicon Graphics, Inc.
cpw@sgi.com
(651) 683-3824

  reply	other threads:[~2009-04-23 13:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-21 15:48 wrong parsing to /proc/self/status causes wrong out-of-range errors Brice Goglin
2009-04-23 13:55 ` Cliff Wickman [this message]
2009-04-23 18:14   ` Lee Schermerhorn
2009-04-23 18:40     ` Cliff Wickman

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=20090423135540.GA20320@sgi.com \
    --to=cpw@sgi.com \
    --cc=Brice.Goglin@inria.fr \
    --cc=ianw@debian.org \
    --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).