Skip to content

Commit

Permalink
x86: reserve highmem pages via reserve_early
Browse files Browse the repository at this point in the history
This patch makes early reserved highmem pages become reserved
pages. This can be used for highmem pages allocated by bootloader such
as EFI memory map, linked list of setup_data, etc.

Signed-off-by: Huang Ying <ying.huang@intel.com>
Cc: andi@firstfloor.org
Cc: mingo@redhat.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Huang, Ying authored and Thomas Gleixner committed Jun 5, 2008
1 parent d3fbe5e commit d0ec2c6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions arch/x86/kernel/e820.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/mm/init_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions include/asm-x86/e820.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d0ec2c6

Please sign in to comment.