aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm
diff options
context:
space:
mode:
authorMichael Bohan <mbohan@codeaurora.org>2010-06-14 16:06:56 -0400
committerDaniel Walker <dwalker@codeaurora.org>2010-06-15 16:19:55 -0400
commit3260e5293727f16ffdce9a6a6203fd9a6b149e58 (patch)
tree5be7569566f262f3c953e8ac9bbec6f656c03354 /arch/arm/mm
parent923a081c72fa2dccb7ea7070bd8e0f4dc99ceff8 (diff)
arm: mm: Don't free prohibited memmap entries
The VM subsystem assumes that there are valid memmap entries to the bank end aligned to MAX_ORDER_NR_PAGES. It will try and read these page structs, and so we cannot free any memmap entries that it may inspect. Signed-off-by: Michael Bohan <mbohan@codeaurora.org> Signed-off-by: Daniel Walker <dwalker@codeaurora.org>
Diffstat (limited to 'arch/arm/mm')
-rw-r--r--arch/arm/mm/init.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f6a999465323..e18c7cedb482 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -495,28 +495,27 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
495 unsigned int i; 495 unsigned int i;
496 496
497 /* 497 /*
498 * [FIXME] This relies on each bank being in address order. This 498 * This relies on each bank being in address order.
499 * may not be the case, especially if the user has provided the 499 * The banks are sorted previously in bootmem_init().
500 * information on the command line.
501 */ 500 */
502 for_each_nodebank(i, mi, node) { 501 for_each_nodebank(i, mi, node) {
503 struct membank *bank = &mi->bank[i]; 502 struct membank *bank = &mi->bank[i];
504 503
505 bank_start = bank_pfn_start(bank); 504 bank_start = bank_pfn_start(bank);
506 if (bank_start < prev_bank_end) {
507 printk(KERN_ERR "MEM: unordered memory banks. "
508 "Not freeing memmap.\n");
509 break;
510 }
511 505
512 /* 506 /*
513 * If we had a previous bank, and there is a space 507 * If we had a previous bank, and there is a space
514 * between the current bank and the previous, free it. 508 * between the current bank and the previous, free it.
515 */ 509 */
516 if (prev_bank_end && prev_bank_end != bank_start) 510 if (prev_bank_end && prev_bank_end < bank_start)
517 free_memmap(node, prev_bank_end, bank_start); 511 free_memmap(node, prev_bank_end, bank_start);
518 512
519 prev_bank_end = bank_pfn_end(bank); 513 /*
514 * Align up here since the VM subsystem insists that the
515 * memmap entries are valid from the bank end aligned to
516 * MAX_ORDER_NR_PAGES.
517 */
518 prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
520 } 519 }
521} 520}
522 521