Commit 8968dab8 authored by Tejun Heo's avatar Tejun Heo

x86-64, NUMA: Remove %NULL @nodeids handling from compute_hash_shift()

numa_emulation() called compute_hash_shift() with %NULL @nodeids which
meant identity mapping between index and nodeid.  Make
numa_emulation() build identity array and drop %NULL @nodeids handling
from populate_memnodemap() and thus from compute_hash_shift().  This
is to prepare for transition to using memblks instead.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Shaohui Zheng <shaohui.zheng@intel.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: H. Peter Anvin <hpa@linux.intel.com>
parent 5d371b08
...@@ -63,12 +63,7 @@ static int __init populate_memnodemap(const struct bootnode *nodes, ...@@ -63,12 +63,7 @@ static int __init populate_memnodemap(const struct bootnode *nodes,
do { do {
if (memnodemap[addr >> shift] != NUMA_NO_NODE) if (memnodemap[addr >> shift] != NUMA_NO_NODE)
return -1; return -1;
memnodemap[addr >> shift] = nodeids[i];
if (!nodeids)
memnodemap[addr >> shift] = i;
else
memnodemap[addr >> shift] = nodeids[i];
addr += (1UL << shift); addr += (1UL << shift);
} while (addr < end); } while (addr < end);
res = 1; res = 1;
...@@ -706,6 +701,7 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size) ...@@ -706,6 +701,7 @@ static int __init split_nodes_size_interleave(u64 addr, u64 max_addr, u64 size)
static int __init numa_emulation(unsigned long start_pfn, static int __init numa_emulation(unsigned long start_pfn,
unsigned long last_pfn, int acpi, int amd) unsigned long last_pfn, int acpi, int amd)
{ {
static int nodeid[NR_NODE_MEMBLKS] __initdata;
u64 addr = start_pfn << PAGE_SHIFT; u64 addr = start_pfn << PAGE_SHIFT;
u64 max_addr = last_pfn << PAGE_SHIFT; u64 max_addr = last_pfn << PAGE_SHIFT;
int num_nodes; int num_nodes;
...@@ -730,7 +726,11 @@ static int __init numa_emulation(unsigned long start_pfn, ...@@ -730,7 +726,11 @@ static int __init numa_emulation(unsigned long start_pfn,
if (num_nodes < 0) if (num_nodes < 0)
return num_nodes; return num_nodes;
memnode_shift = compute_hash_shift(nodes, num_nodes, NULL);
for (i = 0; i < ARRAY_SIZE(nodeid); i++)
nodeid[i] = i;
memnode_shift = compute_hash_shift(nodes, num_nodes, nodeid);
if (memnode_shift < 0) { if (memnode_shift < 0) {
memnode_shift = 0; memnode_shift = 0;
printk(KERN_ERR "No NUMA hash function found. NUMA emulation " printk(KERN_ERR "No NUMA hash function found. NUMA emulation "
......
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