Use common help functions to free reserved pages.
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
        printk(KERN_INFO "Freeing %s: %luk freed\n", what, (end - begin) >> 10);
 
        for (; addr < end; addr += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(addr));
-               init_page_count(virt_to_page(addr));
                memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
-               free_page(addr);
-               totalram_pages++;
+               free_reserved_page(virt_to_page(addr));
        }
 #endif
 }
 
 
        /* clear_bss() already clear the empty_zero_page */
 
-       reservedpages = 0;
-
-       /* this will put all low memory onto the freelists */
        register_page_bootmem_info();
+
+       /* this will put all memory onto the freelists */
        totalram_pages = free_all_bootmem();
 
        absent_pages = absent_pages_in_range(0, max_pfn);