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>
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/nodemask.h>
|
#include <linux/nodemask.h>
|
||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
#include <linux/sort.h>
|
|
||||||
#include <linux/highmem.h>
|
#include <linux/highmem.h>
|
||||||
|
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
@@ -387,21 +386,12 @@ static void arm_memory_present(struct meminfo *mi, int node)
|
|||||||
}
|
}
|
||||||
#endif
|
#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;
|
|
||||||
}
|
|
||||||
|
|
||||||
void __init bootmem_init(void)
|
void __init bootmem_init(void)
|
||||||
{
|
{
|
||||||
struct meminfo *mi = &meminfo;
|
struct meminfo *mi = &meminfo;
|
||||||
unsigned long min, max_low, max_high;
|
unsigned long min, max_low, max_high;
|
||||||
int node, initrd_node;
|
int node, initrd_node;
|
||||||
|
|
||||||
sort(&mi->bank, mi->nr_banks, sizeof(mi->bank[0]), meminfo_cmp, NULL);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate which node contains the ramdisk image, if any.
|
* Locate which node contains the ramdisk image, if any.
|
||||||
*/
|
*/
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include <linux/bootmem.h>
|
#include <linux/bootmem.h>
|
||||||
#include <linux/mman.h>
|
#include <linux/mman.h>
|
||||||
#include <linux/nodemask.h>
|
#include <linux/nodemask.h>
|
||||||
|
#include <linux/sort.h>
|
||||||
|
|
||||||
#include <asm/cputype.h>
|
#include <asm/cputype.h>
|
||||||
#include <asm/mach-types.h>
|
#include <asm/mach-types.h>
|
||||||
@@ -1013,6 +1014,13 @@ static void __init kmap_init(void)
|
|||||||
#endif
|
#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
|
* paging_init() sets up the page tables, initialises the zone memory
|
||||||
* maps, and sets up the zero page, bad page and bad page tables.
|
* 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;
|
void *zero_page;
|
||||||
|
|
||||||
|
sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
|
||||||
|
|
||||||
build_mem_type_table();
|
build_mem_type_table();
|
||||||
sanity_check_meminfo();
|
sanity_check_meminfo();
|
||||||
prepare_page_table();
|
prepare_page_table();
|
||||||
|
Reference in New Issue
Block a user