Skip to content

Commit

Permalink
[PATCH] hugetlb: check p?d_present in huge_pte_offset()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adam Litke authored and Linus Torvalds committed Sep 5, 2005
1 parent 7bf07f3 commit 02b0cce
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arch/i386/mm/hugetlbpage.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 02b0cce

Please sign in to comment.