13 #include <linux/mman.h>
19 #include <asm/uaccess.h>
20 #include <asm/pgtable.h>
23 unsigned long addr,
unsigned long end,
26 #ifdef CONFIG_HUGETLB_PAGE
31 unsigned char present;
39 present = ptep && !huge_pte_none(huge_ptep_get(ptep));
64 unsigned char present = 0;
76 if (radix_tree_exceptional_entry(page)) {
82 present = PageUptodate(page);
90 unsigned long addr,
unsigned long end,
99 pgoff = linear_page_index(vma, addr);
100 for (i = 0; i <
nr; i++, pgoff++)
101 vec[i] = mincore_page(vma->
vm_file->f_mapping, pgoff);
103 for (i = 0; i <
nr; i++)
109 unsigned long addr,
unsigned long end,
116 ptep = pte_offset_map_lock(vma->
vm_mm, pmd, addr, &ptl);
123 mincore_unmapped_range(vma, addr, next, vec);
128 *vec = mincore_page(vma->
vm_file->f_mapping, pgoff);
132 if (is_migration_entry(entry)) {
146 }
while (ptep++, addr = next, addr != end);
147 pte_unmap_unlock(ptep - 1, ptl);
151 unsigned long addr,
unsigned long end,
160 if (pmd_trans_huge(*pmd)) {
167 if (pmd_none_or_trans_huge_or_clear_bad(pmd))
168 mincore_unmapped_range(vma, addr, next, vec);
170 mincore_pte_range(vma, pmd, addr, next, vec);
172 }
while (pmd++, addr = next, addr != end);
176 unsigned long addr,
unsigned long end,
185 if (pud_none_or_clear_bad(pud))
186 mincore_unmapped_range(vma, addr, next, vec);
188 mincore_pmd_range(vma, pud, addr, next, vec);
190 }
while (pud++, addr = next, addr != end);
194 unsigned long addr,
unsigned long end,
202 next = pgd_addr_end(addr, end);
203 if (pgd_none_or_clear_bad(pgd))
204 mincore_unmapped_range(vma, addr, next, vec);
206 mincore_pud_range(vma, pgd, addr, next, vec);
208 }
while (pgd++, addr = next, addr != end);
216 static long do_mincore(
unsigned long addr,
unsigned long pages,
unsigned char *vec)
227 if (is_vm_hugetlb_page(vma)) {
228 mincore_hugetlb_page_range(vma, addr, end, vec);
234 if (is_vm_hugetlb_page(vma))
235 mincore_hugetlb_page_range(vma, addr, end, vec);
237 mincore_page_range(vma, addr, end, vec);
267 unsigned char __user *, vec)
299 retval = do_mincore(
start,
min(pages, PAGE_SIZE), tmp);