3 #include <linux/sched.h>
6 static int walk_pte_range(
pmd_t *
pmd,
unsigned long addr,
unsigned long end,
14 err = walk->pte_entry(pte, addr, addr +
PAGE_SIZE, walk);
27 static int walk_pmd_range(
pud_t *pud,
unsigned long addr,
unsigned long end,
40 err = walk->pte_hole(addr, next, walk);
50 err = walk->pmd_entry(pmd, addr, next, walk);
62 if (pmd_none_or_trans_huge_or_clear_bad(pmd))
64 err = walk_pte_range(pmd, addr, next, walk);
67 }
while (pmd++, addr = next, addr != end);
72 static int walk_pud_range(
pgd_t *pgd,
unsigned long addr,
unsigned long end,
82 if (pud_none_or_clear_bad(pud)) {
84 err = walk->pte_hole(addr, next, walk);
90 err = walk->pud_entry(pud, addr, next, walk);
91 if (!err && (walk->pmd_entry || walk->pte_entry))
92 err = walk_pmd_range(pud, addr, next, walk);
95 }
while (pud++, addr = next, addr != end);
100 #ifdef CONFIG_HUGETLB_PAGE
101 static unsigned long hugetlb_entry_end(
struct hstate *
h,
unsigned long addr,
105 return boundary < end ? boundary :
end;
109 unsigned long addr,
unsigned long end,
110 struct mm_walk *walk)
119 next = hugetlb_entry_end(h, addr, end);
121 if (pte && walk->hugetlb_entry)
122 err = walk->hugetlb_entry(pte, hmask, addr, next, walk);
125 }
while (addr = next, addr != end);
130 static struct vm_area_struct* hugetlb_vma(
unsigned long addr,
struct mm_walk *walk)
135 if (!walk->hugetlb_entry)
140 if (vma && vma->
vm_start <= addr && is_vm_hugetlb_page(vma))
147 static struct vm_area_struct* hugetlb_vma(
unsigned long addr,
struct mm_walk *walk)
153 unsigned long addr,
unsigned long end,
154 struct mm_walk *walk)
189 struct mm_walk *walk)
205 next = pgd_addr_end(addr, end);
212 vma = hugetlb_vma(addr, walk);
220 err = walk_hugetlb_range(vma, addr, next, walk);
227 if (pgd_none_or_clear_bad(pgd)) {
229 err = walk->pte_hole(addr, next, walk);
236 err = walk->pgd_entry(pgd, addr, next, walk);
238 (walk->pud_entry || walk->pmd_entry || walk->pte_entry))
239 err = walk_pud_range(pgd, addr, next, walk);
243 }
while (addr = next, addr != end);