mm/um: use free_highmem_page() to free highmem pages into buddy system
authorJiang Liu <liuj97@gmail.com>
Mon, 29 Apr 2013 22:07:11 +0000 (15:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 29 Apr 2013 22:54:32 +0000 (15:54 -0700)
Use helper function free_highmem_page() to free highmem pages into
the buddy system.

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/um/kernel/mem.c

index d5ac802..9df292b 100644 (file)
@@ -42,17 +42,12 @@ static unsigned long brk_end;
 static void setup_highmem(unsigned long highmem_start,
                          unsigned long highmem_len)
 {
-       struct page *page;
        unsigned long highmem_pfn;
        int i;
 
        highmem_pfn = __pa(highmem_start) >> PAGE_SHIFT;
-       for (i = 0; i < highmem_len >> PAGE_SHIFT; i++) {
-               page = &mem_map[highmem_pfn + i];
-               ClearPageReserved(page);
-               init_page_count(page);
-               __free_page(page);
-       }
+       for (i = 0; i < highmem_len >> PAGE_SHIFT; i++)
+               free_highmem_page(&mem_map[highmem_pfn + i]);
 }
 #endif
 
@@ -73,18 +68,13 @@ void __init mem_init(void)
        totalram_pages = free_all_bootmem();
        max_low_pfn = totalram_pages;
 #ifdef CONFIG_HIGHMEM
-       totalhigh_pages = highmem >> PAGE_SHIFT;
-       totalram_pages += totalhigh_pages;
+       setup_highmem(end_iomem, highmem);
 #endif
        num_physpages = totalram_pages;
        max_pfn = totalram_pages;
        printk(KERN_INFO "Memory: %luk available\n",
               nr_free_pages() << (PAGE_SHIFT-10));
        kmalloc_ok = 1;
-
-#ifdef CONFIG_HIGHMEM
-       setup_highmem(end_iomem, highmem);
-#endif
 }
 
 /*