mm/MIPS: 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: Ralf Baechle <ralf@linux-mips.org> Cc: David Daney <david.daney@cavium.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Jiri Kosina <jkosina@suse.cz> Cc: John Crispin <blogic@openwrt.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Minchan Kim <minchan@kernel.org> 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
6879ea83c6
commit
1132137e87
@@ -359,11 +359,24 @@ void __init paging_init(void)
|
||||
static struct kcore_list kcore_kseg0;
|
||||
#endif
|
||||
|
||||
static inline void mem_init_free_highmem(void)
|
||||
{
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
unsigned long tmp;
|
||||
|
||||
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
|
||||
struct page *page = pfn_to_page(tmp);
|
||||
|
||||
if (!page_is_ram(tmp))
|
||||
SetPageReserved(page);
|
||||
else
|
||||
free_highmem_page(page);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void __init mem_init(void)
|
||||
{
|
||||
unsigned long codesize, reservedpages, datasize, initsize;
|
||||
unsigned long tmp, ram;
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
#ifdef CONFIG_DISCONTIGMEM
|
||||
#error "CONFIG_HIGHMEM and CONFIG_DISCONTIGMEM dont work together yet"
|
||||
@@ -376,32 +389,8 @@ void __init mem_init(void)
|
||||
|
||||
free_all_bootmem();
|
||||
setup_zero_pages(); /* Setup zeroed pages. */
|
||||
|
||||
reservedpages = ram = 0;
|
||||
for (tmp = 0; tmp < max_low_pfn; tmp++)
|
||||
if (page_is_ram(tmp) && pfn_valid(tmp)) {
|
||||
ram++;
|
||||
if (PageReserved(pfn_to_page(tmp)))
|
||||
reservedpages++;
|
||||
}
|
||||
num_physpages = ram;
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
for (tmp = highstart_pfn; tmp < highend_pfn; tmp++) {
|
||||
struct page *page = pfn_to_page(tmp);
|
||||
|
||||
if (!page_is_ram(tmp)) {
|
||||
SetPageReserved(page);
|
||||
continue;
|
||||
}
|
||||
free_highmem_page(page);
|
||||
}
|
||||
num_physpages += totalhigh_pages;
|
||||
#endif
|
||||
|
||||
codesize = (unsigned long) &_etext - (unsigned long) &_text;
|
||||
datasize = (unsigned long) &_edata - (unsigned long) &_etext;
|
||||
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin;
|
||||
mem_init_free_highmem();
|
||||
mem_init_print_info(NULL);
|
||||
|
||||
#ifdef CONFIG_64BIT
|
||||
if ((unsigned long) &_text > (unsigned long) CKSEG0)
|
||||
@@ -410,16 +399,6 @@ void __init mem_init(void)
|
||||
kclist_add(&kcore_kseg0, (void *) CKSEG0,
|
||||
0x80000000 - 4, KCORE_TEXT);
|
||||
#endif
|
||||
|
||||
printk(KERN_INFO "Memory: %luk/%luk available (%ldk kernel code, "
|
||||
"%ldk reserved, %ldk data, %ldk init, %ldk highmem)\n",
|
||||
nr_free_pages() << (PAGE_SHIFT-10),
|
||||
ram << (PAGE_SHIFT-10),
|
||||
codesize >> 10,
|
||||
reservedpages << (PAGE_SHIFT-10),
|
||||
datasize >> 10,
|
||||
initsize >> 10,
|
||||
totalhigh_pages << (PAGE_SHIFT-10));
|
||||
}
|
||||
#endif /* !CONFIG_NEED_MULTIPLE_NODES */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user