mm/ARC: 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: Vineet Gupta <vgupta@synopsys.com> # for arch/arc Cc: James Hogan <james.hogan@imgtec.com> Cc: Rob Herring <rob.herring@calxeda.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
d385d9ee7a
commit
de35e1b828
@@ -74,7 +74,7 @@ void __init setup_arch_memory(void)
|
|||||||
/* Last usable page of low mem (no HIGHMEM yet for ARC port) */
|
/* Last usable page of low mem (no HIGHMEM yet for ARC port) */
|
||||||
max_low_pfn = max_pfn = PFN_DOWN(end_mem);
|
max_low_pfn = max_pfn = PFN_DOWN(end_mem);
|
||||||
|
|
||||||
max_mapnr = num_physpages = max_low_pfn - min_low_pfn;
|
max_mapnr = max_low_pfn - min_low_pfn;
|
||||||
|
|
||||||
/*------------- reserve kernel image -----------------------*/
|
/*------------- reserve kernel image -----------------------*/
|
||||||
memblock_reserve(CONFIG_LINUX_LINK_BASE,
|
memblock_reserve(CONFIG_LINUX_LINK_BASE,
|
||||||
@@ -84,7 +84,7 @@ void __init setup_arch_memory(void)
|
|||||||
|
|
||||||
/*-------------- node setup --------------------------------*/
|
/*-------------- node setup --------------------------------*/
|
||||||
memset(zones_size, 0, sizeof(zones_size));
|
memset(zones_size, 0, sizeof(zones_size));
|
||||||
zones_size[ZONE_NORMAL] = num_physpages;
|
zones_size[ZONE_NORMAL] = max_low_pfn - min_low_pfn;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can't use the helper free_area_init(zones[]) because it uses
|
* We can't use the helper free_area_init(zones[]) because it uses
|
||||||
@@ -106,39 +106,9 @@ void __init setup_arch_memory(void)
|
|||||||
*/
|
*/
|
||||||
void __init mem_init(void)
|
void __init mem_init(void)
|
||||||
{
|
{
|
||||||
int codesize, datasize, initsize, reserved_pages, free_pages;
|
|
||||||
int tmp;
|
|
||||||
|
|
||||||
high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
|
high_memory = (void *)(CONFIG_LINUX_LINK_BASE + arc_mem_sz);
|
||||||
|
|
||||||
free_all_bootmem();
|
free_all_bootmem();
|
||||||
|
mem_init_print_info(NULL);
|
||||||
/* count all reserved pages [kernel code/data/mem_map..] */
|
|
||||||
reserved_pages = 0;
|
|
||||||
for (tmp = 0; tmp < max_mapnr; tmp++)
|
|
||||||
if (PageReserved(mem_map + tmp))
|
|
||||||
reserved_pages++;
|
|
||||||
|
|
||||||
/* XXX: nr_free_pages() is equivalent */
|
|
||||||
free_pages = max_mapnr - reserved_pages;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* For the purpose of display below, split the "reserve mem"
|
|
||||||
* kernel code/data is already shown explicitly,
|
|
||||||
* Show any other reservations (mem_map[ ] et al)
|
|
||||||
*/
|
|
||||||
reserved_pages -= (((unsigned int)_end - CONFIG_LINUX_LINK_BASE) >>
|
|
||||||
PAGE_SHIFT);
|
|
||||||
|
|
||||||
codesize = _etext - _text;
|
|
||||||
datasize = _end - _etext;
|
|
||||||
initsize = __init_end - __init_begin;
|
|
||||||
|
|
||||||
pr_info("Memory Available: %dM / %ldM (%dK code, %dK data, %dK init, %dK reserv)\n",
|
|
||||||
PAGES_TO_MB(free_pages),
|
|
||||||
TO_MB(arc_mem_sz),
|
|
||||||
TO_KB(codesize), TO_KB(datasize), TO_KB(initsize),
|
|
||||||
PAGES_TO_KB(reserved_pages));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user