mm/openrisc: prepare for removing num_physpages and simplify mem_init()

Prepare for removing num_physpages and simplify mem_init().

Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Acked-by: Jonas Bonn <jonas@southpole.se>
Cc: David Howells <dhowells@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Jiang Liu 2013-07-03 15:04:06 -07:00 committed by Linus Torvalds
parent 76feaedeb9
commit 1173db12bf
1 changed files with 4 additions and 40 deletions

View File

@ -202,56 +202,20 @@ void __init paging_init(void)
/* References to section boundaries */
static int __init free_pages_init(void)
{
int reservedpages, pfn;
/* this will put all low memory onto the freelists */
free_all_bootmem();
reservedpages = 0;
for (pfn = 0; pfn < max_low_pfn; pfn++) {
/*
* Only count reserved RAM pages
*/
if (PageReserved(mem_map + pfn))
reservedpages++;
}
return reservedpages;
}
static void __init set_max_mapnr_init(void)
{
max_mapnr = num_physpages = max_low_pfn;
}
void __init mem_init(void)
{
int codesize, reservedpages, datasize, initsize;
BUG_ON(!mem_map);
set_max_mapnr_init();
max_mapnr = max_low_pfn;
high_memory = (void *)__va(max_low_pfn * PAGE_SIZE);
/* clear the zero-page */
memset((void *)empty_zero_page, 0, PAGE_SIZE);
reservedpages = free_pages_init();
/* this will put all low memory onto the freelists */
free_all_bootmem();
codesize = (unsigned long)&_etext - (unsigned long)&_stext;
datasize = (unsigned long)&_edata - (unsigned long)&_etext;
initsize = (unsigned long)&__init_end - (unsigned long)&__init_begin;
printk(KERN_INFO
"Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n",
(unsigned long)nr_free_pages() << (PAGE_SHIFT - 10),
max_mapnr << (PAGE_SHIFT - 10), codesize >> 10,
reservedpages << (PAGE_SHIFT - 10), datasize >> 10,
initsize >> 10, (unsigned long)(0 << (PAGE_SHIFT - 10))
);
mem_init_print_info(NULL);
printk("mem_init_done ...........................................\n");
mem_init_done = 1;