diff options
Diffstat (limited to 'arch/i386/mm/hugetlbpage.c')
-rw-r--r-- | arch/i386/mm/hugetlbpage.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c index 3b099f32b948..57c486f0e896 100644 --- a/arch/i386/mm/hugetlbpage.c +++ b/arch/i386/mm/hugetlbpage.c | |||
@@ -22,12 +22,21 @@ pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr) | |||
22 | { | 22 | { |
23 | pgd_t *pgd; | 23 | pgd_t *pgd; |
24 | pud_t *pud; | 24 | pud_t *pud; |
25 | pmd_t *pmd = NULL; | 25 | pmd_t *pmd; |
26 | pte_t *pte = NULL; | ||
26 | 27 | ||
27 | pgd = pgd_offset(mm, addr); | 28 | pgd = pgd_offset(mm, addr); |
28 | pud = pud_alloc(mm, pgd, addr); | 29 | pud = pud_alloc(mm, pgd, addr); |
29 | pmd = pmd_alloc(mm, pud, addr); | 30 | pmd = pmd_alloc(mm, pud, addr); |
30 | return (pte_t *) pmd; | 31 | |
32 | if (!pmd) | ||
33 | goto out; | ||
34 | |||
35 | pte = (pte_t *) pmd; | ||
36 | if (!pte_none(*pte) && !pte_huge(*pte)) | ||
37 | hugetlb_clean_stale_pgtable(pte); | ||
38 | out: | ||
39 | return pte; | ||
31 | } | 40 | } |
32 | 41 | ||
33 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) | 42 | pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) |