Skip to contentSkip to conversation

fix pgt_buf_end when memory hotplug

PATCH In review Lai Jiangshan 2 participants 3 messages Sep 8, 2011 – Sep 21, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix pgt_buf_end when memory hotplug

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().

---

arch/x86/mm/init_64.c +2 -1
index bbaaa00..e138e0a 100644
@@ -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");
 
#1 lore raw
Quoted 5 lines · Lai Jiangshan

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

initial kernel pagetable allocation wasted ffffffffffffffff pages

I take you are using tip/x86/mm, because that is the only branch that contains that warning.

Quoted 19 lines

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().

---

arch/x86/mm/init_64.c +1 -1
index bbaaa00..e138e0a 100644
@@ -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) {

arch/x86/mm/init_64.c static __ref void *alloc_low_page(unsigned long *phys) · line 332

Quoted 6 lines
arch/x86/mm/init_64.c +1 -0
@@ -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");

This patch makes sense to me. It would also make sense to print the "allocation wasted" warning only if (!after_bootmem).

#2 lore raw
Quoted 9 lines · Stefano Stabellini
Quoted 5 lines · Lai Jiangshan

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

initial kernel pagetable allocation wasted ffffffffffffffff pages

I take you are using tip/x86/mm, because that is the only branch that contains that warning.

No,
I was using tip/master.

Thanks,
Lai

Quoted 37 lines
Quoted 21 lines

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().

---

arch/x86/mm/init_64.c +1 -1
index bbaaa00..e138e0a 100644
@@ -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) {

arch/x86/mm/init_64.c static __ref void *alloc_low_page(unsigned long *phys) · line 332

Quoted 6 lines
arch/x86/mm/init_64.c +1 -0
@@ -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");

This patch makes sense to me. It would also make sense to print the "allocation wasted" warning only if (!after_bootmem).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/