7 #include <linux/sched.h>
13 #include <asm/pgtable.h>
17 #ifndef CONFIG_X86_PAE
83 pte_t pte = gup_get_pte(ptep);
93 SetPageReferenced(page);
97 }
while (ptep++, addr +=
PAGE_SIZE, addr != end);
103 static inline void get_head_page_multiple(
struct page *page,
int nr)
108 SetPageReferenced(page);
111 static noinline int gup_huge_pmd(
pmd_t pmd,
unsigned long addr,
112 unsigned long end,
int write,
struct page **pages,
int *nr)
135 get_huge_page_tail(page);
139 }
while (addr +=
PAGE_SIZE, addr != end);
140 get_head_page_multiple(head, refs);
145 static int gup_pmd_range(
pud_t pud,
unsigned long addr,
unsigned long end,
146 int write,
struct page **pages,
int *nr)
167 if (
pmd_none(pmd) || pmd_trans_splitting(pmd))
170 if (!gup_huge_pmd(pmd, addr, next, write, pages, nr))
173 if (!gup_pte_range(pmd, addr, next, write, pages, nr))
176 }
while (pmdp++, addr = next, addr != end);
181 static noinline int gup_huge_pud(
pud_t pud,
unsigned long addr,
182 unsigned long end,
int write,
struct page **pages,
int *nr)
205 get_huge_page_tail(page);
209 }
while (addr +=
PAGE_SIZE, addr != end);
210 get_head_page_multiple(head, refs);
215 static int gup_pud_range(
pgd_t pgd,
unsigned long addr,
unsigned long end,
216 int write,
struct page **pages,
int *nr)
229 if (!gup_huge_pud(pud, addr, next, write, pages, nr))
232 if (!gup_pmd_range(pud, addr, next, write, pages, nr))
235 }
while (pudp++, addr = next, addr != end);
259 (
void __user *)start, len)))
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);
357 next = pgd_addr_end(addr, end);
360 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
362 }
while (pgdp++, addr = next, addr != end);
380 (end - start) >> PAGE_SHIFT, write, 0, pages,
NULL);