diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index ac5e9ebf70ea63ad940fea7cf29e4e5633b493fc..a706e9057ba54ac0c7be026d6438481be9dd1c5f 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c @@ -612,6 +612,17 @@ void __init free_early(u64 start, u64 end) early_res[j - 1].end = 0; } +int __init page_is_reserved_early(unsigned long pagenr) +{ + u64 start = (u64)pagenr << PAGE_SHIFT; + int i; + struct early_res *r; + + i = find_overlapped_early(start, start + PAGE_SIZE); + r = &early_res[i]; + return (i < MAX_EARLY_RES && r->end); +} + void __init early_res_to_bootmem(u64 start, u64 end) { int i; diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index ec30d10154b657a63ab07b5e25b4298c10f4aabe..0e7bb5e81670e577de9ab19a9e5a350fb4d55d6b 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -289,7 +289,8 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base) void __init add_one_highpage_init(struct page *page, int pfn, int bad_ppro) { - if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn))) { + if (page_is_ram(pfn) && !(bad_ppro && page_kills_ppro(pfn)) && + !page_is_reserved_early(pfn)) { ClearPageReserved(page); init_page_count(page); __free_page(page); diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h index 44ed9c0a4dfd1c86df1656dda13e03786ef19c02..8aa32323a1822642ee709fca7e50fbf760d74b8c 100644 --- a/include/asm-x86/e820.h +++ b/include/asm-x86/e820.h @@ -86,6 +86,7 @@ extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align); extern void reserve_early(u64 start, u64 end, char *name); extern void free_early(u64 start, u64 end); extern void early_res_to_bootmem(u64 start, u64 end); +extern int page_is_reserved_early(unsigned long pagenr); extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align); extern unsigned long e820_end_of_ram(void);