root/include/linux/pagewalk.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   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 struct mm_walk;
   8 
   9 /**
  10  * mm_walk_ops - callbacks for walk_page_range
  11  * @pud_entry:          if set, called for each non-empty PUD (2nd-level) entry
  12  *                      this handler should only handle pud_trans_huge() puds.
  13  *                      the pmd_entry or pte_entry callbacks will be used for
  14  *                      regular PUDs.
  15  * @pmd_entry:          if set, called for each non-empty PMD (3rd-level) entry
  16  *                      this handler is required to be able to handle
  17  *                      pmd_trans_huge() pmds.  They may simply choose to
  18  *                      split_huge_page() instead of handling it explicitly.
  19  * @pte_entry:          if set, called for each non-empty PTE (4th-level) entry
  20  * @pte_hole:           if set, called for each hole at all levels
  21  * @hugetlb_entry:      if set, called for each hugetlb entry
  22  * @test_walk:          caller specific callback function to determine whether
  23  *                      we walk over the current vma or not. Returning 0 means
  24  *                      "do page table walk over the current vma", returning
  25  *                      a negative value means "abort current page table walk
  26  *                      right now" and returning 1 means "skip the current vma"
  27  */
  28 struct mm_walk_ops {
  29         int (*pud_entry)(pud_t *pud, unsigned long addr,
  30                          unsigned long next, struct mm_walk *walk);
  31         int (*pmd_entry)(pmd_t *pmd, unsigned long addr,
  32                          unsigned long next, struct mm_walk *walk);
  33         int (*pte_entry)(pte_t *pte, unsigned long addr,
  34                          unsigned long next, struct mm_walk *walk);
  35         int (*pte_hole)(unsigned long addr, unsigned long next,
  36                         struct mm_walk *walk);
  37         int (*hugetlb_entry)(pte_t *pte, unsigned long hmask,
  38                              unsigned long addr, unsigned long next,
  39                              struct mm_walk *walk);
  40         int (*test_walk)(unsigned long addr, unsigned long next,
  41                         struct mm_walk *walk);
  42 };
  43 
  44 /**
  45  * mm_walk - walk_page_range data
  46  * @ops:        operation to call during the walk
  47  * @mm:         mm_struct representing the target process of page table walk
  48  * @vma:        vma currently walked (NULL if walking outside vmas)
  49  * @private:    private data for callbacks' usage
  50  *
  51  * (see the comment on walk_page_range() for more details)
  52  */
  53 struct mm_walk {
  54         const struct mm_walk_ops *ops;
  55         struct mm_struct *mm;
  56         struct vm_area_struct *vma;
  57         void *private;
  58 };
  59 
  60 int walk_page_range(struct mm_struct *mm, unsigned long start,
  61                 unsigned long end, const struct mm_walk_ops *ops,
  62                 void *private);
  63 int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
  64                 void *private);
  65 
  66 #endif /* _LINUX_PAGEWALK_H */

/* [<][>][^][v][top][bottom][index][help] */