提交 ccecb510 编写于 作者: J Jiang Liu 提交者: Linus Torvalds

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

Use common help functions to free reserved pages.
Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 e16e0b1b
...@@ -316,24 +316,6 @@ void __init bootmem_init(void) ...@@ -316,24 +316,6 @@ void __init bootmem_init(void)
max_pfn = max_high - PHYS_PFN_OFFSET; max_pfn = max_high - PHYS_PFN_OFFSET;
} }
static inline int free_area(unsigned long pfn, unsigned long end, char *s)
{
unsigned int pages = 0, size = (end - pfn) << (PAGE_SHIFT - 10);
for (; pfn < end; pfn++) {
struct page *page = pfn_to_page(pfn);
ClearPageReserved(page);
init_page_count(page);
__free_page(page);
pages++;
}
if (size && s)
printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
return pages;
}
static inline void static inline void
free_memmap(unsigned long start_pfn, unsigned long end_pfn) free_memmap(unsigned long start_pfn, unsigned long end_pfn)
{ {
...@@ -407,9 +389,9 @@ void __init mem_init(void) ...@@ -407,9 +389,9 @@ void __init mem_init(void)
max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
/* this will put all unused low memory onto the freelists */
free_unused_memmap(&meminfo); free_unused_memmap(&meminfo);
/* this will put all unused low memory onto the freelists */
totalram_pages += free_all_bootmem(); totalram_pages += free_all_bootmem();
reserved_pages = free_pages = 0; reserved_pages = free_pages = 0;
...@@ -494,9 +476,7 @@ void __init mem_init(void) ...@@ -494,9 +476,7 @@ void __init mem_init(void)
void free_initmem(void) void free_initmem(void)
{ {
totalram_pages += free_area(__phys_to_pfn(__pa(__init_begin)), free_initmem_default(0);
__phys_to_pfn(__pa(__init_end)),
"init");
} }
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
...@@ -506,9 +486,7 @@ static int keep_initrd; ...@@ -506,9 +486,7 @@ static int keep_initrd;
void free_initrd_mem(unsigned long start, unsigned long end) void free_initrd_mem(unsigned long start, unsigned long end)
{ {
if (!keep_initrd) if (!keep_initrd)
totalram_pages += free_area(__phys_to_pfn(__pa(start)), free_reserved_area(start, end, 0, "initrd");
__phys_to_pfn(__pa(end)),
"initrd");
} }
static int __init keepinitrd_setup(char *__unused) static int __init keepinitrd_setup(char *__unused)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册