Commit 88448b65 authored by Jiang Liu's avatar Jiang Liu Committed by Linus Torvalds

mm/SH: use common help functions to free reserved pages

Use common help functions to free reserved pages.
Signed-off-by: default avatarJiang Liu <jiang.liu@huawei.com>
Acked-by: default avatarPaul Mundt <lethal@linux-sh.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7265d80f
...@@ -417,15 +417,13 @@ void __init mem_init(void) ...@@ -417,15 +417,13 @@ void __init mem_init(void)
for_each_online_node(nid) { for_each_online_node(nid) {
pg_data_t *pgdat = NODE_DATA(nid); pg_data_t *pgdat = NODE_DATA(nid);
unsigned long node_pages = 0;
void *node_high_memory; void *node_high_memory;
num_physpages += pgdat->node_present_pages; num_physpages += pgdat->node_present_pages;
if (pgdat->node_spanned_pages) if (pgdat->node_spanned_pages)
node_pages = free_all_bootmem_node(pgdat); totalram_pages += free_all_bootmem_node(pgdat);
totalram_pages += node_pages;
node_high_memory = (void *)__va((pgdat->node_start_pfn + node_high_memory = (void *)__va((pgdat->node_start_pfn +
pgdat->node_spanned_pages) << pgdat->node_spanned_pages) <<
...@@ -501,31 +499,13 @@ void __init mem_init(void) ...@@ -501,31 +499,13 @@ void __init mem_init(void)
void free_initmem(void) void free_initmem(void)
{ {
unsigned long addr; free_initmem_default(0);
addr = (unsigned long)(&__init_begin);
for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
ClearPageReserved(virt_to_page(addr));
init_page_count(virt_to_page(addr));
free_page(addr);
totalram_pages++;
}
printk("Freeing unused kernel memory: %ldk freed\n",
((unsigned long)&__init_end -
(unsigned long)&__init_begin) >> 10);
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
unsigned long p; free_reserved_area(start, end, 0, "initrd");
for (p = start; p < end; p += PAGE_SIZE) {
ClearPageReserved(virt_to_page(p));
init_page_count(virt_to_page(p));
free_page(p);
totalram_pages++;
}
printk("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
} }
#endif #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