]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - include/linux/pagewalk.h
mm: split out a new pagewalk.h header from mm.h
[mirror_ubuntu-focal-kernel.git] / include / linux / pagewalk.h
CommitLineData
a520110e
CH
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_PAGEWALK_H
3#define _LINUX_PAGEWALK_H
4
5#include <linux/mm.h>
6
7/**
8 * mm_walk - callbacks for walk_page_range
9 * @pud_entry: if set, called for each non-empty PUD (2nd-level) entry
10 * this handler should only handle pud_trans_huge() puds.
11 * the pmd_entry or pte_entry callbacks will be used for
12 * regular PUDs.
13 * @pmd_entry: if set, called for each non-empty PMD (3rd-level) entry
14 * this handler is required to be able to handle
15 * pmd_trans_huge() pmds. They may simply choose to
16 * split_huge_page() instead of handling it explicitly.
17 * @pte_entry: if set, called for each non-empty PTE (4th-level) entry
18 * @pte_hole: if set, called for each hole at all levels
19 * @hugetlb_entry: if set, called for each hugetlb entry
20 * @test_walk: caller specific callback function to determine whether
21 * we walk over the current vma or not. Returning 0
22 * value means "do page table walk over the current vma,"
23 * and a negative one means "abort current page table walk
24 * right now." 1 means "skip the current vma."
25 * @mm: mm_struct representing the target process of page table walk
26 * @vma: vma currently walked (NULL if walking outside vmas)
27 * @private: private data for callbacks' usage
28 *
29 * (see the comment on walk_page_range() for more details)
30 */
31struct mm_walk {
32 int (*pud_entry)(pud_t *pud, unsigned long addr,
33 unsigned long next, struct mm_walk *walk);
34 int (*pmd_entry)(pmd_t *pmd, unsigned long addr,
35 unsigned long next, struct mm_walk *walk);
36 int (*pte_entry)(pte_t *pte, unsigned long addr,
37 unsigned long next, struct mm_walk *walk);
38 int (*pte_hole)(unsigned long addr, unsigned long next,
39 struct mm_walk *walk);
40 int (*hugetlb_entry)(pte_t *pte, unsigned long hmask,
41 unsigned long addr, unsigned long next,
42 struct mm_walk *walk);
43 int (*test_walk)(unsigned long addr, unsigned long next,
44 struct mm_walk *walk);
45 struct mm_struct *mm;
46 struct vm_area_struct *vma;
47 void *private;
48};
49
50int walk_page_range(unsigned long addr, unsigned long end,
51 struct mm_walk *walk);
52int walk_page_vma(struct vm_area_struct *vma, struct mm_walk *walk);
53
54#endif /* _LINUX_PAGEWALK_H */