aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/i386/mm/hugetlbpage.c23
-rw-r--r--include/asm-i386/page.h1
-rw-r--r--include/asm-x86_64/page.h1
-rw-r--r--include/linux/hugetlb.h6
4 files changed, 3 insertions, 28 deletions
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
index 24c8a536b588..d524127c9afc 100644
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -22,20 +22,14 @@ 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;
26 pte_t *pte = NULL; 25 pte_t *pte = NULL;
27 26
28 pgd = pgd_offset(mm, addr); 27 pgd = pgd_offset(mm, addr);
29 pud = pud_alloc(mm, pgd, addr); 28 pud = pud_alloc(mm, pgd, addr);
30 pmd = pmd_alloc(mm, pud, addr); 29 if (pud)
30 pte = (pte_t *) pmd_alloc(mm, pud, addr);
31 BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
31 32
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);
38out:
39 return pte; 33 return pte;
40} 34}
41 35
@@ -130,17 +124,6 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
130} 124}
131#endif 125#endif
132 126
133void hugetlb_clean_stale_pgtable(pte_t *pte)
134{
135 pmd_t *pmd = (pmd_t *) pte;
136 struct page *page;
137
138 page = pmd_page(*pmd);
139 pmd_clear(pmd);
140 dec_page_state(nr_page_table_pages);
141 page_cache_release(page);
142}
143
144/* x86_64 also uses this file */ 127/* x86_64 also uses this file */
145 128
146#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA 129#ifdef HAVE_ARCH_HUGETLB_UNMAPPED_AREA
diff --git a/include/asm-i386/page.h b/include/asm-i386/page.h
index 10045fd82103..73296d9924fb 100644
--- a/include/asm-i386/page.h
+++ b/include/asm-i386/page.h
@@ -68,7 +68,6 @@ typedef struct { unsigned long pgprot; } pgprot_t;
68#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 68#define HPAGE_MASK (~(HPAGE_SIZE - 1))
69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 69#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA 70#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
71#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
72#endif 71#endif
73 72
74#define pgd_val(x) ((x).pgd) 73#define pgd_val(x) ((x).pgd)
diff --git a/include/asm-x86_64/page.h b/include/asm-x86_64/page.h
index fcf890aa8c81..135ffaa0393b 100644
--- a/include/asm-x86_64/page.h
+++ b/include/asm-x86_64/page.h
@@ -28,7 +28,6 @@
28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 28#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
29#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 29#define HPAGE_MASK (~(HPAGE_SIZE - 1))
30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 30#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
31#define ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
32 31
33#ifdef __KERNEL__ 32#ifdef __KERNEL__
34#ifndef __ASSEMBLY__ 33#ifndef __ASSEMBLY__
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index f529d1442815..e670b0d13fe0 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -70,12 +70,6 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
70void hugetlb_prefault_arch_hook(struct mm_struct *mm); 70void hugetlb_prefault_arch_hook(struct mm_struct *mm);
71#endif 71#endif
72 72
73#ifndef ARCH_HAS_HUGETLB_CLEAN_STALE_PGTABLE
74#define hugetlb_clean_stale_pgtable(pte) BUG()
75#else
76void hugetlb_clean_stale_pgtable(pte_t *pte);
77#endif
78
79#else /* !CONFIG_HUGETLB_PAGE */ 73#else /* !CONFIG_HUGETLB_PAGE */
80 74
81static inline int is_vm_hugetlb_page(struct vm_area_struct *vma) 75static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)