提交 3260e529 编写于 作者: M Michael Bohan 提交者: Daniel Walker

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: NMichael Bohan <mbohan@codeaurora.org>
Signed-off-by: NDaniel Walker <dwalker@codeaurora.org>
上级 923a081c
...@@ -495,28 +495,27 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi) ...@@ -495,28 +495,27 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
unsigned int i; unsigned int i;
/* /*
* [FIXME] This relies on each bank being in address order. This * This relies on each bank being in address order.
* may not be the case, especially if the user has provided the * The banks are sorted previously in bootmem_init().
* information on the command line.
*/ */
for_each_nodebank(i, mi, node) { for_each_nodebank(i, mi, node) {
struct membank *bank = &mi->bank[i]; struct membank *bank = &mi->bank[i];
bank_start = bank_pfn_start(bank); bank_start = bank_pfn_start(bank);
if (bank_start < prev_bank_end) {
printk(KERN_ERR "MEM: unordered memory banks. "
"Not freeing memmap.\n");
break;
}
/* /*
* If we had a previous bank, and there is a space * If we had a previous bank, and there is a space
* between the current bank and the previous, free it. * between the current bank and the previous, free it.
*/ */
if (prev_bank_end && prev_bank_end != bank_start) if (prev_bank_end && prev_bank_end < bank_start)
free_memmap(node, prev_bank_end, bank_start); free_memmap(node, prev_bank_end, bank_start);
prev_bank_end = bank_pfn_end(bank); /*
* 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);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册