aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/mm/hugetlbpage.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mm/hugetlbpage.c')
-rw-r--r--arch/i386/mm/hugetlbpage.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
index 3b099f32b948..d524127c9afc 100644
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -22,12 +22,15 @@ 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 pte_t *pte = NULL;
26 26
27 pgd = pgd_offset(mm, addr); 27 pgd = pgd_offset(mm, addr);
28 pud = pud_alloc(mm, pgd, addr); 28 pud = pud_alloc(mm, pgd, addr);
29 pmd = pmd_alloc(mm, pud, addr); 29 if (pud)
30 return (pte_t *) pmd; 30 pte = (pte_t *) pmd_alloc(mm, pud, addr);
31 BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
32
33 return pte;
31} 34}
32 35
33pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr) 36pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
@@ -37,8 +40,11 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
37 pmd_t *pmd = NULL; 40 pmd_t *pmd = NULL;
38 41
39 pgd = pgd_offset(mm, addr); 42 pgd = pgd_offset(mm, addr);
40 pud = pud_offset(pgd, addr); 43 if (pgd_present(*pgd)) {
41 pmd = pmd_offset(pud, addr); 44 pud = pud_offset(pgd, addr);
45 if (pud_present(*pud))
46 pmd = pmd_offset(pud, addr);
47 }
42 return (pte_t *) pmd; 48 return (pte_t *) pmd;
43} 49}
44 50
@@ -118,17 +124,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
118} 124}
119#endif 125#endif
120 126
121void hugetlb_clean_stale_pgtable(pte_t *pte)
122{
123 pmd_t *pmd = (pmd_t *) pte;
124 struct page *page;
125
126 page = pmd_page(*pmd);
127 pmd_clear(pmd);
128 dec_page_state(nr_page_table_pages);
129 page_cache_release(page);
130}
131
132/* x86_64 also uses this file */ 127/* x86_64 also uses this file */
133 128
134#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA 129#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA