[PARISC] Unbreak discontigmem mem_init()

The `simple' way of walking and checking PageReserved is broken on
discontigmem, instead we need to check each range explicitly.

(Also rename a few things so they make more sense.)

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
This commit is contained in:
Kyle McMartin 2006-10-16 20:34:00 -04:00 committed by Kyle McMartin
parent ce8420bb65
commit 53faf2910d
1 changed files with 32 additions and 18 deletions

View File

@ -455,7 +455,6 @@ unsigned long pcxl_dma_start __read_mostly;
void __init mem_init(void) void __init mem_init(void)
{ {
int codesize, reservedpages, datasize, initsize; int codesize, reservedpages, datasize, initsize;
int tmp;
high_memory = __va((max_pfn << PAGE_SHIFT)); high_memory = __va((max_pfn << PAGE_SHIFT));
@ -470,17 +469,33 @@ void __init mem_init(void)
totalram_pages += free_all_bootmem_node(NODE_DATA(i)); totalram_pages += free_all_bootmem_node(NODE_DATA(i));
} }
#endif #endif
codesize = (unsigned long) &_etext - (unsigned long) &_text;
datasize = (unsigned long) &_edata - (unsigned long) &_etext; codesize = (unsigned long)_etext - (unsigned long)_text;
initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; datasize = (unsigned long)_edata - (unsigned long)_etext;
initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
reservedpages = 0; reservedpages = 0;
for (tmp = 0; tmp < max_low_pfn; tmp++) {
unsigned long pfn;
#ifdef CONFIG_DISCONTIGMEM
int i;
for (i = 0; i < npmem_ranges; i++) {
for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
if (PageReserved(pfn_to_page(pfn)))
reservedpages++;
}
}
#else /* !CONFIG_DISCONTIGMEM */
for (pfn = 0; pfn < max_pfn; pfn++) {
/* /*
* Only count reserved RAM pages * Only count reserved RAM pages
*/ */
if (PageReserved(pfn_to_page(tmp))) if (PageReserved(pfn_to_page(pfn)))
reservedpages++; reservedpages++;
}
#endif
}
#ifdef CONFIG_PA11 #ifdef CONFIG_PA11
if (hppa_dma_ops == &pcxl_dma_ops) { if (hppa_dma_ops == &pcxl_dma_ops) {
@ -494,20 +509,19 @@ void __init mem_init(void)
vmalloc_start = SET_MAP_OFFSET(MAP_START); vmalloc_start = SET_MAP_OFFSET(MAP_START);
#endif #endif
printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
(unsigned long) nr_free_pages() << (PAGE_SHIFT-10), (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
num_physpages << (PAGE_SHIFT-10), num_physpages << (PAGE_SHIFT-10),
codesize >> 10, codesize >> 10,
reservedpages << (PAGE_SHIFT-10), reservedpages << (PAGE_SHIFT-10),
datasize >> 10, datasize >> 10,
initsize >> 10, initsize >> 10
(unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) );
);
#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ #ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
printk("virtual kernel memory layout:\n" printk("virtual kernel memory layout:\n"
" vmalloc : 0x%p - 0x%p (%4ld MB)\n" " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
" lowmem : 0x%p - 0x%p (%4ld MB)\n" " memory : 0x%p - 0x%p (%4ld MB)\n"
" .init : 0x%p - 0x%p (%4ld kB)\n" " .init : 0x%p - 0x%p (%4ld kB)\n"
" .data : 0x%p - 0x%p (%4ld kB)\n" " .data : 0x%p - 0x%p (%4ld kB)\n"
" .text : 0x%p - 0x%p (%4ld kB)\n", " .text : 0x%p - 0x%p (%4ld kB)\n",
@ -518,14 +532,14 @@ void __init mem_init(void)
__va(0), high_memory, __va(0), high_memory,
((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
&__init_begin, &__init_end, __init_begin, __init_end,
((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10, ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10,
&_etext, &_edata, _etext, _edata,
((unsigned long)&_edata - (unsigned long)&_etext) >> 10, ((unsigned long)_edata - (unsigned long)_etext) >> 10,
&_text, &_etext, _text, _etext,
((unsigned long)&_etext - (unsigned long)&_text) >> 10); ((unsigned long)_etext - (unsigned long)_text) >> 10);
#endif #endif
} }