aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32/mm
diff options
context:
space:
mode:
authorJiang Liu <liuj97@gmail.com>2013-07-03 18:04:17 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-03 19:07:38 -0400
commit0d0b6d26ad52093452b1228325a99244e925582a (patch)
treef3a81629263e8e613002aea69c5e05ecc5ce0958 /arch/unicore32/mm
parent715ee356535e861c0c0890697fa48eeb8af94019 (diff)
mm/unicore32: 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> Cc: Guan Xuetao <gxt@mprc.pku.edu.cn> Cc: Michal Hocko <mhocko@suse.cz> Cc: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/unicore32/mm')
-rw-r--r--arch/unicore32/mm/init.c49
1 files changed, 2 insertions, 47 deletions
diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c
index 7d1356c466b9..ae6bc036db92 100644
--- a/arch/unicore32/mm/init.c
+++ b/arch/unicore32/mm/init.c
@@ -383,10 +383,6 @@ static void __init free_unused_memmap(struct meminfo *mi)
383 */ 383 */
384void __init mem_init(void) 384void __init mem_init(void)
385{ 385{
386 unsigned long reserved_pages, free_pages;
387 struct memblock_region *reg;
388 int i;
389
390 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 386 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
391 387
392 free_unused_memmap(&meminfo); 388 free_unused_memmap(&meminfo);
@@ -394,48 +390,7 @@ void __init mem_init(void)
394 /* this will put all unused low memory onto the freelists */ 390 /* this will put all unused low memory onto the freelists */
395 free_all_bootmem(); 391 free_all_bootmem();
396 392
397 reserved_pages = free_pages = 0; 393 mem_init_print_info(NULL);
398
399 for_each_bank(i, &meminfo) {
400 struct membank *bank = &meminfo.bank[i];
401 unsigned int pfn1, pfn2;
402 struct page *page, *end;
403
404 pfn1 = bank_pfn_start(bank);
405 pfn2 = bank_pfn_end(bank);
406
407 page = pfn_to_page(pfn1);
408 end = pfn_to_page(pfn2 - 1) + 1;
409
410 do {
411 if (PageReserved(page))
412 reserved_pages++;
413 else if (!page_count(page))
414 free_pages++;
415 page++;
416 } while (page < end);
417 }
418
419 /*
420 * Since our memory may not be contiguous, calculate the
421 * real number of pages we have in this system
422 */
423 printk(KERN_INFO "Memory:");
424 num_physpages = 0;
425 for_each_memblock(memory, reg) {
426 unsigned long pages = memblock_region_memory_end_pfn(reg) -
427 memblock_region_memory_base_pfn(reg);
428 num_physpages += pages;
429 printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
430 }
431 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
432
433 printk(KERN_NOTICE "Memory: %luk/%luk available, %luk reserved, %luK highmem\n",
434 nr_free_pages() << (PAGE_SHIFT-10),
435 free_pages << (PAGE_SHIFT-10),
436 reserved_pages << (PAGE_SHIFT-10),
437 totalhigh_pages << (PAGE_SHIFT-10));
438
439 printk(KERN_NOTICE "Virtual kernel memory layout:\n" 394 printk(KERN_NOTICE "Virtual kernel memory layout:\n"
440 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" 395 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
441 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" 396 " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n"
@@ -464,7 +419,7 @@ void __init mem_init(void)
464 BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); 419 BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR);
465 BUG_ON(TASK_SIZE > MODULES_VADDR); 420 BUG_ON(TASK_SIZE > MODULES_VADDR);
466 421
467 if (PAGE_SIZE >= 16384 && num_physpages <= 128) { 422 if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) {
468 /* 423 /*
469 * On a machine this small we won't get 424 * On a machine this small we won't get
470 * anywhere without overcommit, so turn 425 * anywhere without overcommit, so turn