Pull memoryless-node-allocation into release branch

This commit is contained in:
Tony Luck 2005-11-10 10:38:41 -08:00
commit 4ddccb8eb9
1 changed files with 9 additions and 10 deletions

View File

@ -350,14 +350,12 @@ static void __init initialize_pernode_data(void)
* for best. * for best.
* @nid: node id * @nid: node id
* @pernodesize: size of this node's pernode data * @pernodesize: size of this node's pernode data
* @align: alignment to use for this node's pernode data
*/ */
static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize, static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
unsigned long align)
{ {
void *ptr = NULL; void *ptr = NULL;
u8 best = 0xff; u8 best = 0xff;
int bestnode = -1, node; int bestnode = -1, node, anynode = 0;
for_each_online_node(node) { for_each_online_node(node) {
if (node_isset(node, memory_less_mask)) if (node_isset(node, memory_less_mask))
@ -366,13 +364,15 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize,
best = node_distance(nid, node); best = node_distance(nid, node);
bestnode = node; bestnode = node;
} }
anynode = node;
} }
ptr = __alloc_bootmem_node(mem_data[bestnode].pgdat, if (bestnode == -1)
pernodesize, align, __pa(MAX_DMA_ADDRESS)); bestnode = anynode;
ptr = __alloc_bootmem_node(mem_data[bestnode].pgdat, pernodesize,
PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
if (!ptr)
panic("NO memory for memory less node\n");
return ptr; return ptr;
} }
@ -413,8 +413,7 @@ static void __init memory_less_nodes(void)
for_each_node_mask(node, memory_less_mask) { for_each_node_mask(node, memory_less_mask) {
pernodesize = compute_pernodesize(node); pernodesize = compute_pernodesize(node);
pernode = memory_less_node_alloc(node, pernodesize, pernode = memory_less_node_alloc(node, pernodesize);
(node) ? (node * PERCPU_PAGE_SIZE) : (1024*1024));
fill_pernode(node, __pa(pernode), pernodesize); fill_pernode(node, __pa(pernode), pernodesize);
} }