[PATCH x86,mm] fix pgt_buf_end when memory hotplug

Lai Jiangshan
2011-09-08T09:32:49Z

When I test memory hotplug, such message is always outputted when hot-adding
a memory block:

initial kernel pagetable allocation wasted ffffffffffffffff pages

This message comes from init_memory_mapping(), it shows "pgt_buf_end" is
incorrect here, and I found it was caused by alloc_low_page().

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index bbaaa00..e138e0a 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -317,7 +317,7 @@ void __init cleanup_highmap(void)

static __ref void *alloc_low_page(unsigned long *phys)
{
- unsigned long pfn = pgt_buf_end++;
+ unsigned long pfn;
void *adr;

if (after_bootmem) {
@@ -327,6 +327,7 @@ static __ref void *alloc_low_page(unsigned long *phys)
return adr;
}

+ pfn = pgt_buf_end++;
if (pfn >= pgt_buf_top)
panic("alloc_low_page: ran out of memory");