]> err.no Git - linux-2.6/commitdiff
[PATCH] hugetlb: check p?d_present in huge_pte_offset()
authorAdam Litke <agl@us.ibm.com>
Sat, 3 Sep 2005 22:55:01 +0000 (15:55 -0700)
committerLinus Torvalds <torvalds@evo.osdl.org>
Mon, 5 Sep 2005 07:05:46 +0000 (00:05 -0700)
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>
arch/i386/mm/hugetlbpage.c

index 57c486f0e896c71056fcd139a6b3e1faec925ba0..24c8a536b58829db0200f4be494edcff45f36bc1 100644 (file)
@@ -46,8 +46,11 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
        pmd_t *pmd = NULL;
 
        pgd = pgd_offset(mm, addr);
-       pud = pud_offset(pgd, addr);
-       pmd = pmd_offset(pud, addr);
+       if (pgd_present(*pgd)) {
+               pud = pud_offset(pgd, addr);
+               if (pud_present(*pud))
+                       pmd = pmd_offset(pud, addr);
+       }
        return (pte_t *) pmd;
 }