linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org, discuss@x86-64.org
Subject: Re: [NUMA , x86_64] Why memnode_shift is chosen with the lowest possible value ?
Date: Tue, 04 Oct 2005 23:12:02 +0200	[thread overview]
Message-ID: <4342F022.3060509@cosmosbay.com> (raw)
In-Reply-To: <200510041913.26332.ak@suse.de>

Andi Kleen a écrit :
> On Friday 30 September 2005 11:09, Eric Dumazet wrote:
> 
>>+       while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0)
>>+               shift++;
> 
> 
> 
> Why shift+1 here? 

Thank you Andi fo r reviewing this stuff

The idea it to find the highest shift value, and to break the loop as soon as 
the (shift + 1) value gives us an "shift too big" error.

Maybe you want to write :

         while (populate_memnodemap(nodes, numnodes, ++shift) >= 0) ;
	shift--;

Well, thats only style...


> 
> 
>>+               if ((end >> shift) >= NODEMAPSIZE)
>>+                       return 0;
> 
> 
> This should be >, not >= shouldn't it?

Let's take an example

end   = 0xffffffff;
start = 0xfff00000;
shift = 20
Suppose that NODEMAPSIZE == (end >> shift) == 0xfff

If the test is changed to :

if ((end >> shift) > NODEMAPSIZE)
	return 0;

We could do one of the iteration with (addr < end) but (addr >> shift) == 
NODEMAPSIZE

if (memnodemap[NODEMAPSIZE] != 0xff)
	return -1;
memnodemap[NODMAPSIZE] = i;

Thats bound violation of memnodemap[]

AFAIK, I wonder why NODEMAPSIZE is 0xfff and not 0x1000, because this off by 
one make half of memnodemap[] to be unused for power of two ram size.


> 
> -Andi
> 
> P.S.: Please cc x86-64 patches to discuss@x86-64.org

Ah thank you

Eric

  reply	other threads:[~2005-10-04 21:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-28 20:25 [PATCH 0/3] Demand faulting for huge pages Adam Litke
2005-09-28 20:31 ` [PATCH 1/3 htlb-get_user_pages] " Adam Litke
2005-09-28 20:32 ` [PATCH 2/3 htlb-fault] " Adam Litke
2005-09-29  6:09   ` Andrew Morton
2005-09-29  6:10   ` Andrew Morton
2005-09-28 20:33 ` [PATCH 3/3 htlb-acct] " Adam Litke
2005-09-29  6:20   ` Andrew Morton
2005-09-29  9:45     ` Andi Kleen
2005-09-29 13:40       ` [NUMA , x86_64] Why memnode_shift is chosen with the lowest possible value ? Eric Dumazet
2005-09-29 13:43         ` Andi Kleen
2005-09-29 16:59           ` Eric Dumazet
2005-09-30  9:09             ` Eric Dumazet
2005-10-04 17:13               ` Andi Kleen
2005-10-04 21:12                 ` Eric Dumazet [this message]
2005-09-29 13:32 ` [PATCH 0/3] Demand faulting for huge pages Hugh Dickins
2005-10-06 15:22   ` Adam Litke

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=4342F022.3060509@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=ak@suse.de \
    --cc=discuss@x86-64.org \
    --cc=linux-kernel@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).