Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] hugetlb: check p?d_present in huge_pte_offset()

For demand faulting, we cannot assume that the page tables will be
populated. Do what the rest of the architectures do and test p?d_present()
while walking down the page table.

Signed-off-by: Adam Litke <agl@us.ibm.com>
Cc: <linux-mm@kvack.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Adam Litke and committed by
Linus Torvalds
02b0ccef 7bf07f3d

+5 -2
+5 -2
arch/i386/mm/hugetlbpage.c
··· 46 46 pmd_t *pmd = NULL; 47 47 48 48 pgd = pgd_offset(mm, addr); 49 - pud = pud_offset(pgd, addr); 50 - pmd = pmd_offset(pud, addr); 49 + if (pgd_present(*pgd)) { 50 + pud = pud_offset(pgd, addr); 51 + if (pud_present(*pud)) 52 + pmd = pmd_offset(pud, addr); 53 + } 51 54 return (pte_t *) pmd; 52 55 } 53 56