8 #include <linux/sched.h>
15 #include <asm/pgtable.h>
19 #if defined(CONFIG_64BIT_PHYS_ADDR) && defined(CONFIG_CPU_MIPS32)
36 static int gup_pte_range(
pmd_t pmd,
unsigned long addr,
unsigned long end,
41 pte_t pte = gup_get_pte(ptep);
52 SetPageReferenced(page);
56 }
while (ptep++, addr +=
PAGE_SIZE, addr != end);
62 static inline void get_head_page_multiple(
struct page *page,
int nr)
67 SetPageReferenced(page);
70 static int gup_huge_pmd(
pmd_t pmd,
unsigned long addr,
unsigned long end,
71 int write,
struct page **pages,
int *nr)
90 get_huge_page_tail(page);
96 get_head_page_multiple(head, refs);
100 static int gup_pmd_range(
pud_t pud,
unsigned long addr,
unsigned long end,
101 int write,
struct page **pages,
int *nr)
122 if (
pmd_none(pmd) || pmd_trans_splitting(pmd))
125 if (!gup_huge_pmd(pmd, addr, next, write, pages,nr))
128 if (!gup_pte_range(pmd, addr, next, write, pages,nr))
131 }
while (pmdp++, addr = next, addr != end);
136 static int gup_huge_pud(
pud_t pud,
unsigned long addr,
unsigned long end,
137 int write,
struct page **pages,
int *nr)
156 get_huge_page_tail(page);
160 }
while (addr +=
PAGE_SIZE, addr != end);
162 get_head_page_multiple(head, refs);
166 static int gup_pud_range(
pgd_t pgd,
unsigned long addr,
unsigned long end,
167 int write,
struct page **pages,
int *nr)
180 if (!gup_huge_pud(pud, addr, next, write, pages,nr))
183 if (!gup_pmd_range(pud, addr, next, write, pages,nr))
186 }
while (pudp++, addr = next, addr != end);
210 (
void __user *)start, len)))
235 next = pgd_addr_end(addr, end);
238 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
240 }
while (pgdp++, addr = next, addr != end);
285 next = pgd_addr_end(addr, end);
288 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
290 }
while (pgdp++, addr = next, addr != end);
305 (end - start) >> PAGE_SHIFT,
306 write, 0, pages,
NULL);