hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/mm/pgtable-generic.c
....@@ -2,14 +2,15 @@
22 /*
33 * mm/pgtable-generic.c
44 *
5
- * Generic pgtable methods declared in asm-generic/pgtable.h
5
+ * Generic pgtable methods declared in linux/pgtable.h
66 *
77 * Copyright (C) 2010 Linus Torvalds
88 */
99
1010 #include <linux/pagemap.h>
11
+#include <linux/hugetlb.h>
12
+#include <linux/pgtable.h>
1113 #include <asm/tlb.h>
12
-#include <asm-generic/pgtable.h>
1314
1415 /*
1516 * If a p?d_bad entry is found while walking page tables, report
....@@ -23,18 +24,27 @@
2324 pgd_clear(pgd);
2425 }
2526
27
+#ifndef __PAGETABLE_P4D_FOLDED
2628 void p4d_clear_bad(p4d_t *p4d)
2729 {
2830 p4d_ERROR(*p4d);
2931 p4d_clear(p4d);
3032 }
33
+#endif
3134
35
+#ifndef __PAGETABLE_PUD_FOLDED
3236 void pud_clear_bad(pud_t *pud)
3337 {
3438 pud_ERROR(*pud);
3539 pud_clear(pud);
3640 }
41
+#endif
3742
43
+/*
44
+ * Note that the pmd variant below can't be stub'ed out just as for p4d/pud
45
+ * above. pmd folding is special and typically pmd_* macros refer to upper
46
+ * level even when folded
47
+ */
3848 void pmd_clear_bad(pmd_t *pmd)
3949 {
4050 pmd_ERROR(*pmd);
....@@ -43,7 +53,7 @@
4353
4454 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
4555 /*
46
- * Only sets the access flags (dirty, accessed), as well as write
56
+ * Only sets the access flags (dirty, accessed), as well as write
4757 * permission. Furthermore, we know it always gets set to a "more
4858 * permissive" setting, which allows most architectures to optimize
4959 * this. We return whether the PTE actually changed, which in turn
....@@ -184,7 +194,7 @@
184194 pmd_t pmdp_invalidate(struct vm_area_struct *vma, unsigned long address,
185195 pmd_t *pmdp)
186196 {
187
- pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mknotpresent(*pmdp));
197
+ pmd_t old = pmdp_establish(vma, address, pmdp, pmd_mkinvalid(*pmdp));
188198 flush_pmd_tlb_range(vma, address, address + HPAGE_PMD_SIZE);
189199 return old;
190200 }