Commit 5b472b20 authored by Jiang Liu's avatar Jiang Liu Committed by Linus Torvalds

mm/um: use free_highmem_page() to free highmem pages into buddy system

Use helper function free_highmem_page() to free highmem pages into
the buddy system.
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 32e1a109
...@@ -42,17 +42,12 @@ static unsigned long brk_end; ...@@ -42,17 +42,12 @@ static unsigned long brk_end;
static void setup_highmem(unsigned long highmem_start, static void setup_highmem(unsigned long highmem_start,
unsigned long highmem_len) unsigned long highmem_len)
{ {
struct page *page;
unsigned long highmem_pfn; unsigned long highmem_pfn;
int i; int i;
highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT; highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) { for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
page = &mem_map[highmem_pfn + i]; free_highmem_page(&mem_map[highmem_pfn + i]);
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
}
} }
#endif #endif
...@@ -73,18 +68,13 @@ void __init mem_init(void) ...@@ -73,18 +68,13 @@ void __init mem_init(void)
totalram_pages = free_all_bootmem(); totalram_pages = free_all_bootmem();
max_low_pfn = totalram_pages; max_low_pfn = totalram_pages;
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
totalhigh_pages = highmem >> PAGE_SHIFT; setup_highmem(end_iomem, highmem);
totalram_pages += totalhigh_pages;
#endif #endif
num_physpages = totalram_pages; num_physpages = totalram_pages;
max_pfn = totalram_pages; max_pfn = totalram_pages;
printk(KERN_INFO "Memory: %luk available\n", printk(KERN_INFO "Memory: %luk available\n",
nr_free_pages() << (PAGE_SHIFT-10)); nr_free_pages() << (PAGE_SHIFT-10));
kmalloc_ok = 1; kmalloc_ok = 1;
#ifdef CONFIG_HIGHMEM
setup_highmem(end_iomem, highmem);
#endif
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment