~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/pagewalk.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/pagewalk.h (Version linux-6.12-rc7) and /include/linux/pagewalk.h (Version linux-5.4.285)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_PAGEWALK_H                           2 #ifndef _LINUX_PAGEWALK_H
  3 #define _LINUX_PAGEWALK_H                           3 #define _LINUX_PAGEWALK_H
  4                                                     4 
  5 #include <linux/mm.h>                               5 #include <linux/mm.h>
  6                                                     6 
  7 struct mm_walk;                                     7 struct mm_walk;
  8                                                     8 
  9 /* Locking requirement during a page walk. */  << 
 10 enum page_walk_lock {                          << 
 11         /* mmap_lock should be locked for read << 
 12         PGWALK_RDLOCK = 0,                     << 
 13         /* vma will be write-locked during the << 
 14         PGWALK_WRLOCK = 1,                     << 
 15         /* vma is expected to be already write << 
 16         PGWALK_WRLOCK_VERIFY = 2,              << 
 17 };                                             << 
 18                                                << 
 19 /**                                                 9 /**
 20  * struct mm_walk_ops - callbacks for walk_pag !!  10  * mm_walk_ops - callbacks for walk_page_range
 21  * @pgd_entry:          if set, called for eac !!  11  * @pud_entry:          if set, called for each non-empty PUD (2nd-level) entry
 22  * @p4d_entry:          if set, called for eac !!  12  *                      this handler should only handle pud_trans_huge() puds.
 23  * @pud_entry:          if set, called for eac !!  13  *                      the pmd_entry or pte_entry callbacks will be used for
 24  * @pmd_entry:          if set, called for eac !!  14  *                      regular PUDs.
                                                   >>  15  * @pmd_entry:          if set, called for each non-empty PMD (3rd-level) entry
 25  *                      this handler is requir     16  *                      this handler is required to be able to handle
 26  *                      pmd_trans_huge() pmds.     17  *                      pmd_trans_huge() pmds.  They may simply choose to
 27  *                      split_huge_page() inst     18  *                      split_huge_page() instead of handling it explicitly.
 28  * @pte_entry:          if set, called for eac !!  19  * @pte_entry:          if set, called for each non-empty PTE (4th-level) entry
 29  *                      including empty ones   !!  20  * @pte_hole:           if set, called for each hole at all levels
 30  * @pte_hole:           if set, called for eac !!  21  * @hugetlb_entry:      if set, called for each hugetlb entry
 31  *                      depth is -1 if not kno << 
 32  *                      Any folded depths (whe << 
 33  *                      are skipped.           << 
 34  * @hugetlb_entry:      if set, called for eac << 
 35  *                      function is called wit << 
 36  *                      protect against a conc << 
 37  *                      the ptl. In some cases << 
 38  *                      and retake the vma loc << 
 39  *                      while calling other fu << 
 40  *                      function must either r << 
 41  *                      ptl after dropping the << 
 42  *                      those items after re-a << 
 43  *                      accessing them.        << 
 44  * @test_walk:          caller specific callba     22  * @test_walk:          caller specific callback function to determine whether
 45  *                      we walk over the curre     23  *                      we walk over the current vma or not. Returning 0 means
 46  *                      "do page table walk ov     24  *                      "do page table walk over the current vma", returning
 47  *                      a negative value means     25  *                      a negative value means "abort current page table walk
 48  *                      right now" and returni     26  *                      right now" and returning 1 means "skip the current vma"
 49  *                      Note that this callbac << 
 50  *                      passes in a single VMA << 
 51  * @pre_vma:            if set, called before  << 
 52  * @post_vma:           if set, called after a << 
 53  *                      that @pre_vma and the  << 
 54  *                                             << 
 55  * p?d_entry callbacks are called even if thos << 
 56  * particular architecture/configuration.      << 
 57  */                                                27  */
 58 struct mm_walk_ops {                               28 struct mm_walk_ops {
 59         int (*pgd_entry)(pgd_t *pgd, unsigned  << 
 60                          unsigned long next, s << 
 61         int (*p4d_entry)(p4d_t *p4d, unsigned  << 
 62                          unsigned long next, s << 
 63         int (*pud_entry)(pud_t *pud, unsigned      29         int (*pud_entry)(pud_t *pud, unsigned long addr,
 64                          unsigned long next, s     30                          unsigned long next, struct mm_walk *walk);
 65         int (*pmd_entry)(pmd_t *pmd, unsigned      31         int (*pmd_entry)(pmd_t *pmd, unsigned long addr,
 66                          unsigned long next, s     32                          unsigned long next, struct mm_walk *walk);
 67         int (*pte_entry)(pte_t *pte, unsigned      33         int (*pte_entry)(pte_t *pte, unsigned long addr,
 68                          unsigned long next, s     34                          unsigned long next, struct mm_walk *walk);
 69         int (*pte_hole)(unsigned long addr, un     35         int (*pte_hole)(unsigned long addr, unsigned long next,
 70                         int depth, struct mm_w !!  36                         struct mm_walk *walk);
 71         int (*hugetlb_entry)(pte_t *pte, unsig     37         int (*hugetlb_entry)(pte_t *pte, unsigned long hmask,
 72                              unsigned long add     38                              unsigned long addr, unsigned long next,
 73                              struct mm_walk *w     39                              struct mm_walk *walk);
 74         int (*test_walk)(unsigned long addr, u     40         int (*test_walk)(unsigned long addr, unsigned long next,
 75                         struct mm_walk *walk);     41                         struct mm_walk *walk);
 76         int (*pre_vma)(unsigned long start, un << 
 77                        struct mm_walk *walk);  << 
 78         void (*post_vma)(struct mm_walk *walk) << 
 79         enum page_walk_lock walk_lock;         << 
 80 };                                             << 
 81                                                << 
 82 /*                                             << 
 83  * Action for pud_entry / pmd_entry callbacks. << 
 84  * ACTION_SUBTREE is the default               << 
 85  */                                            << 
 86 enum page_walk_action {                        << 
 87         /* Descend to next level, splitting hu << 
 88         ACTION_SUBTREE = 0,                    << 
 89         /* Continue to next entry at this leve << 
 90         ACTION_CONTINUE = 1,                   << 
 91         /* Call again for this entry */        << 
 92         ACTION_AGAIN = 2                       << 
 93 };                                                 42 };
 94                                                    43 
 95 /**                                                44 /**
 96  * struct mm_walk - walk_page_range data       !!  45  * mm_walk - walk_page_range data
 97  * @ops:        operation to call during the w     46  * @ops:        operation to call during the walk
 98  * @mm:         mm_struct representing the tar     47  * @mm:         mm_struct representing the target process of page table walk
 99  * @pgd:        pointer to PGD; only valid wit << 
100  * @vma:        vma currently walked (NULL if      48  * @vma:        vma currently walked (NULL if walking outside vmas)
101  * @action:     next action to perform (see en << 
102  * @no_vma:     walk ignoring vmas (vma will a << 
103  * @private:    private data for callbacks' us     49  * @private:    private data for callbacks' usage
104  *                                                 50  *
105  * (see the comment on walk_page_range() for m     51  * (see the comment on walk_page_range() for more details)
106  */                                                52  */
107 struct mm_walk {                                   53 struct mm_walk {
108         const struct mm_walk_ops *ops;             54         const struct mm_walk_ops *ops;
109         struct mm_struct *mm;                      55         struct mm_struct *mm;
110         pgd_t *pgd;                            << 
111         struct vm_area_struct *vma;                56         struct vm_area_struct *vma;
112         enum page_walk_action action;          << 
113         bool no_vma;                           << 
114         void *private;                             57         void *private;
115 };                                                 58 };
116                                                    59 
117 int walk_page_range(struct mm_struct *mm, unsi     60 int walk_page_range(struct mm_struct *mm, unsigned long start,
118                 unsigned long end, const struc     61                 unsigned long end, const struct mm_walk_ops *ops,
119                 void *private);                    62                 void *private);
120 int walk_page_range_novma(struct mm_struct *mm << 
121                           unsigned long end, c << 
122                           pgd_t *pgd,          << 
123                           void *private);      << 
124 int walk_page_range_vma(struct vm_area_struct  << 
125                         unsigned long end, con << 
126                         void *private);        << 
127 int walk_page_vma(struct vm_area_struct *vma,      63 int walk_page_vma(struct vm_area_struct *vma, const struct mm_walk_ops *ops,
128                 void *private);                    64                 void *private);
129 int walk_page_mapping(struct address_space *ma << 
130                       pgoff_t nr, const struct << 
131                       void *private);          << 
132                                                << 
133 typedef int __bitwise folio_walk_flags_t;      << 
134                                                << 
135 /*                                             << 
136  * Walk migration entries as well. Careful: a  << 
137  * concurrently.                               << 
138  */                                            << 
139 #define FW_MIGRATION                    ((__fo << 
140                                                << 
141 /* Walk shared zeropages (small + huge) as wel << 
142 #define FW_ZEROPAGE                     ((__fo << 
143                                                << 
144 enum folio_walk_level {                        << 
145         FW_LEVEL_PTE,                          << 
146         FW_LEVEL_PMD,                          << 
147         FW_LEVEL_PUD,                          << 
148 };                                             << 
149                                                << 
150 /**                                            << 
151  * struct folio_walk - folio_walk_start() / fo << 
152  * @page:       exact folio page referenced (i << 
153  * @level:      page table level identifying t << 
154  * @pte:        pointer to the page table entr << 
155  * @pmd:        pointer to the page table entr << 
156  * @pud:        pointer to the page table entr << 
157  * @ptl:        pointer to the page table lock << 
158  *                                             << 
159  * (see folio_walk_start() documentation for m << 
160  */                                            << 
161 struct folio_walk {                            << 
162         /* public */                           << 
163         struct page *page;                     << 
164         enum folio_walk_level level;           << 
165         union {                                << 
166                 pte_t *ptep;                   << 
167                 pud_t *pudp;                   << 
168                 pmd_t *pmdp;                   << 
169         };                                     << 
170         union {                                << 
171                 pte_t pte;                     << 
172                 pud_t pud;                     << 
173                 pmd_t pmd;                     << 
174         };                                     << 
175         /* private */                          << 
176         struct vm_area_struct *vma;            << 
177         spinlock_t *ptl;                       << 
178 };                                             << 
179                                                << 
180 struct folio *folio_walk_start(struct folio_wa << 
181                 struct vm_area_struct *vma, un << 
182                 folio_walk_flags_t flags);     << 
183                                                << 
184 #define folio_walk_end(__fw, __vma) do { \     << 
185         spin_unlock((__fw)->ptl); \            << 
186         if (likely((__fw)->level == FW_LEVEL_P << 
187                 pte_unmap((__fw)->ptep); \     << 
188         vma_pgtable_walk_end(__vma); \         << 
189 } while (0)                                    << 
190                                                    65 
191 #endif /* _LINUX_PAGEWALK_H */                     66 #endif /* _LINUX_PAGEWALK_H */
192                                                    67 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php