lkml.org 
[lkml]   [2008]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] [5/8] Fix logic error in 64bit memory hotadd
Date

The memory hotadd code assumes that the pud always exists already, but
that might be not true. Allocate it if it isn't there.

Signed-off-by: Andi Kleen <ak@suse.de>

---
arch/x86/mm/init_64.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

Index: linux/arch/x86/mm/init_64.c
===================================================================
--- linux.orig/arch/x86/mm/init_64.c
+++ linux/arch/x86/mm/init_64.c
@@ -432,17 +432,22 @@ void __init_refok init_memory_mapping(un
unsigned long pud_phys;
pud_t *pud;

- if (after_bootmem)
+ if (after_bootmem) {
pud = pud_offset(pgd, start & PGDIR_MASK);
- else
+ if (!pud_present(*pud)) {
+ pud = (pud_t *)get_zeroed_page(GFP_ATOMIC);
+ if (!pud)
+ panic("Out of memory");
+ }
+ pud_phys = __pa(pud);
+ } else
pud = alloc_low_page(&pud_phys);

next = start + PGDIR_SIZE;
if (next > end)
next = end;
phys_pud_init(pud, __pa(start), __pa(next));
- if (!after_bootmem)
- set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
+ set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
unmap_low_page(pud);
}


\
 
 \ /
  Last update: 2008-02-11 10:39    [W:0.085 / U:4.792 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site