Commit 54413927 authored by Amul Shah's avatar Amul Shah Committed by Andi Kleen

[PATCH] x86-64: x86_64-make-the-numa-hash-function-nodemap-allocation fix fix

- Removed an extraneous debug message from allocate_cachealigned_map

- Changed extract_lsb_from_nodes to return 63 for the case where there was
  only one memory node.  The prevents the creation of the dynamic hashmap.

- Changed extract_lsb_from_nodes to use only the starting memory address of
  a node.  On an ES7000, our nodes overlap the starting and ending address,
  meaning, that we see nodes like

	00000 - 10000
	10000 - 20000

  But other systems have nodes whose start and end addresses do not overlap.
   For example:

	00000 - 0FFFF
	10000 - 1FFFF

  In this case, using the ending address will result in an LSB much lower
  than what is possible.  In this case an LSB of 1 when in reality it should
  be 16.

Cc: Andi Kleen <ak@suse.de>
Cc: Rohit Seth <rohitseth@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent 076422d2
...@@ -78,11 +78,8 @@ static int __init allocate_cachealigned_memnodemap(void) ...@@ -78,11 +78,8 @@ static int __init allocate_cachealigned_memnodemap(void)
unsigned long pad, pad_addr; unsigned long pad, pad_addr;
memnodemap = memnode.embedded_map; memnodemap = memnode.embedded_map;
if (memnodemapsize <= 48) { if (memnodemapsize <= 48)
printk(KERN_DEBUG "NUMA: Allocated memnodemap from %lx - %lx\n",
nodemap_addr, nodemap_addr + nodemap_size);
return 0; return 0;
}
pad = L1_CACHE_BYTES - 1; pad = L1_CACHE_BYTES - 1;
pad_addr = 0x8000; pad_addr = 0x8000;
...@@ -110,7 +107,7 @@ static int __init allocate_cachealigned_memnodemap(void) ...@@ -110,7 +107,7 @@ static int __init allocate_cachealigned_memnodemap(void)
static int __init static int __init
extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes) extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes)
{ {
int i; int i, nodes_used = 0;
unsigned long start, end; unsigned long start, end;
unsigned long bitfield = 0, memtop = 0; unsigned long bitfield = 0, memtop = 0;
...@@ -119,11 +116,15 @@ extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes) ...@@ -119,11 +116,15 @@ extract_lsb_from_nodes (const struct bootnode *nodes, int numnodes)
end = nodes[i].end; end = nodes[i].end;
if (start >= end) if (start >= end)
continue; continue;
bitfield |= start | end; bitfield |= start;
nodes_used++;
if (end > memtop) if (end > memtop)
memtop = end; memtop = end;
} }
i = find_first_bit(&bitfield, sizeof(unsigned long)*8); if (nodes_used <= 1)
i = 63;
else
i = find_first_bit(&bitfield, sizeof(unsigned long)*8);
memnodemapsize = (memtop >> i)+1; memnodemapsize = (memtop >> i)+1;
return i; return i;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment