Skip to content

Commit

Permalink
Fix alloc_node_mem_map() to work on ia64 again
Browse files Browse the repository at this point in the history
In commit a1c34a3 ("mm: Don't offset memmap for flatmem") Laura
fixed a problem for Srinivas relating to the bottom 2MB of RAM on an ARM
IFC6410 board.

One small wrinkle on ia64 is that it allocates the node_mem_map earlier
in arch code, so it skips the block of code where "offset" is
initialized.

Move initialization of start and offset before the check for the
node_mem_map so that they will always be available in the latter part of
the function.

Tested-by: Laura Abbott <[email protected]>
Fixes: a1c34a3 (mm: Don't offset memmap for flatmem)
Signed-off-by: Tony Luck <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
aegl authored and torvalds committed Nov 10, 2015
1 parent 3934bbc commit b0aeba7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5266,25 +5266,26 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat)

static void __init_refok alloc_node_mem_map(struct pglist_data *pgdat)
{
unsigned long __maybe_unused start = 0;
unsigned long __maybe_unused offset = 0;

/* Skip empty nodes */
if (!pgdat->node_spanned_pages)
return;

#ifdef CONFIG_FLAT_NODE_MEM_MAP
start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
offset = pgdat->node_start_pfn - start;
/* ia64 gets its own node_mem_map, before this, without bootmem */
if (!pgdat->node_mem_map) {
unsigned long size, start, end;
unsigned long size, end;
struct page *map;

/*
* The zone's endpoints aren't required to be MAX_ORDER
* aligned but the node_mem_map endpoints must be in order
* for the buddy allocator to function correctly.
*/
start = pgdat->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
offset = pgdat->node_start_pfn - start;
end = pgdat_end_pfn(pgdat);
end = ALIGN(end, MAX_ORDER_NR_PAGES);
size = (end - start) * sizeof(struct page);
Expand Down

0 comments on commit b0aeba7

Please sign in to comment.