Skip to content

Commit

Permalink
arm: mm: Exclude additional mem_map entries from free
Browse files Browse the repository at this point in the history
A previous patch addressed the issue of move_freepages_block()
trampling on erronously freed mem_map entries for the bank end
pfn. We also need to restrict the start pfn in a
complementary manner.

Also make macro usage consistent by adopting the use of
round_down and round_up.

CRs-fixed: 339813
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
(cherry picked from commit 3a99a03af19781dcf1074e70461505e2d773bba1)

Change-Id: I5c5d1e0ec90a6b4fc283474a5c033abbada38402
Signed-off-by: Srivalli Oguri <oguri@codeaurora.org>
  • Loading branch information
Michael Bohan authored and Kali- committed May 22, 2012
1 parent 1d4accc commit 7f2c483
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions arch/arm/mm/init.c
Expand Up @@ -533,7 +533,10 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
}

/*
* The mem_map array can get very big. Free the unused area of the memory map.
* The mem_map array can get very big. Free as much of the unused portion of
* the mem_map that we are allowed to. The page migration code moves pages
* in blocks that are rounded per the MAX_ORDER_NR_PAGES definition, so we
* can't free mem_map entries that may be dereferenced in this manner.
*/
static void __init free_unused_memmap_node(int node, struct meminfo *mi)
{
Expand All @@ -547,7 +550,8 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
for_each_nodebank(i, mi, node) {
struct membank *bank = &mi->bank[i];

bank_start = bank_pfn_start(bank);
bank_start = round_down(bank_pfn_start(bank),
MAX_ORDER_NR_PAGES);

/*
* If we had a previous bank, and there is a space
Expand All @@ -556,12 +560,8 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
if (prev_bank_end && prev_bank_end < bank_start)
free_memmap(node, prev_bank_end, bank_start);

/*
* Align up here since the VM subsystem insists that the
* memmap entries are valid from the bank end aligned to
* MAX_ORDER_NR_PAGES.
*/
prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
prev_bank_end = round_up(bank_pfn_end(bank),
MAX_ORDER_NR_PAGES);
}
}

Expand Down

0 comments on commit 7f2c483

Please sign in to comment.