diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-03-25 18:47:20 +0000 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-15 15:03:49 +0100 |
commit | ceb683d3bc36f213aeef0c5d79e6fbb1e16bd459 (patch) | |
tree | a01d44449f12a866bd292d95a37db638820f0cd8 /arch/arm/mm/mmu.c | |
parent | 6262c92f51ffb074800d5a340ee16bc06758e037 (diff) |
ARM: Ensure meminfo is sorted prior to sanity_check_meminfo
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/mmu.c')
-rw-r--r-- | arch/arm/mm/mmu.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 9d4da6ac28e..91547196915 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -14,6 +14,7 @@ #include <linux/bootmem.h> #include <linux/mman.h> #include <linux/nodemask.h> +#include <linux/sort.h> #include <asm/cputype.h> #include <asm/mach-types.h> @@ -1013,6 +1014,13 @@ static void __init kmap_init(void) #endif } +static int __init meminfo_cmp(const void *_a, const void *_b) +{ + const struct membank *a = _a, *b = _b; + long cmp = bank_pfn_start(a) - bank_pfn_start(b); + return cmp < 0 ? -1 : cmp > 0 ? 1 : 0; +} + /* * paging_init() sets up the page tables, initialises the zone memory * maps, and sets up the zero page, bad page and bad page tables. @@ -1021,6 +1029,8 @@ void __init paging_init(struct machine_desc *mdesc) { void *zero_page; + sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL); + build_mem_type_table(); sanity_check_meminfo(); prepare_page_table(); |