1 #ifndef _LINUX_MMU_NOTIFIER_H
2 #define _LINUX_MMU_NOTIFIER_H
4 #include <linux/list.h>
10 struct mmu_notifier_ops;
12 #ifdef CONFIG_MMU_NOTIFIER
20 struct mmu_notifier_mm {
27 struct mmu_notifier_ops {
61 int (*clear_flush_young)(
struct mmu_notifier *mn,
71 int (*test_young)(
struct mmu_notifier *mn,
79 void (*change_pte)(
struct mmu_notifier *mn,
91 void (*invalidate_page)(
struct mmu_notifier *mn,
138 void (*invalidate_range_start)(
struct mmu_notifier *mn,
140 unsigned long start,
unsigned long end);
141 void (*invalidate_range_end)(
struct mmu_notifier *mn,
143 unsigned long start,
unsigned long end);
157 struct mmu_notifier {
159 const struct mmu_notifier_ops *
ops;
162 static inline int mm_has_notifiers(
struct mm_struct *mm)
164 return unlikely(mm->mmu_notifier_mm);
184 unsigned long start,
unsigned long end);
186 unsigned long start,
unsigned long end);
188 static inline void mmu_notifier_release(
struct mm_struct *mm)
190 if (mm_has_notifiers(mm))
194 static inline int mmu_notifier_clear_flush_young(
struct mm_struct *mm,
197 if (mm_has_notifiers(mm))
202 static inline int mmu_notifier_test_young(
struct mm_struct *mm,
203 unsigned long address)
205 if (mm_has_notifiers(mm))
210 static inline void mmu_notifier_change_pte(
struct mm_struct *mm,
213 if (mm_has_notifiers(mm))
217 static inline void mmu_notifier_invalidate_page(
struct mm_struct *mm,
218 unsigned long address)
220 if (mm_has_notifiers(mm))
224 static inline void mmu_notifier_invalidate_range_start(
struct mm_struct *mm,
225 unsigned long start,
unsigned long end)
227 if (mm_has_notifiers(mm))
231 static inline void mmu_notifier_invalidate_range_end(
struct mm_struct *mm,
232 unsigned long start,
unsigned long end)
234 if (mm_has_notifiers(mm))
238 static inline void mmu_notifier_mm_init(
struct mm_struct *mm)
240 mm->mmu_notifier_mm =
NULL;
243 static inline void mmu_notifier_mm_destroy(
struct mm_struct *mm)
245 if (mm_has_notifiers(mm))
249 #define ptep_clear_flush_young_notify(__vma, __address, __ptep) \
252 struct vm_area_struct *___vma = __vma; \
253 unsigned long ___address = __address; \
254 __young = ptep_clear_flush_young(___vma, ___address, __ptep); \
255 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
260 #define pmdp_clear_flush_young_notify(__vma, __address, __pmdp) \
263 struct vm_area_struct *___vma = __vma; \
264 unsigned long ___address = __address; \
265 __young = pmdp_clear_flush_young(___vma, ___address, __pmdp); \
266 __young |= mmu_notifier_clear_flush_young(___vma->vm_mm, \
281 #define set_pte_at_notify(__mm, __address, __ptep, __pte) \
283 struct mm_struct *___mm = __mm; \
284 unsigned long ___address = __address; \
285 pte_t ___pte = __pte; \
287 mmu_notifier_change_pte(___mm, ___address, ___pte); \
288 set_pte_at(___mm, ___address, __ptep, ___pte); \
293 static inline void mmu_notifier_release(
struct mm_struct *mm)
297 static inline int mmu_notifier_clear_flush_young(
struct mm_struct *mm,
298 unsigned long address)
303 static inline int mmu_notifier_test_young(
struct mm_struct *mm,
304 unsigned long address)
309 static inline void mmu_notifier_change_pte(
struct mm_struct *mm,
310 unsigned long address,
pte_t pte)
314 static inline void mmu_notifier_invalidate_page(
struct mm_struct *mm,
315 unsigned long address)
319 static inline void mmu_notifier_invalidate_range_start(
struct mm_struct *mm,
320 unsigned long start,
unsigned long end)
324 static inline void mmu_notifier_invalidate_range_end(
struct mm_struct *mm,
325 unsigned long start,
unsigned long end)
329 static inline void mmu_notifier_mm_init(
struct mm_struct *mm)
333 static inline void mmu_notifier_mm_destroy(
struct mm_struct *mm)
337 #define ptep_clear_flush_young_notify ptep_clear_flush_young
338 #define pmdp_clear_flush_young_notify pmdp_clear_flush_young
339 #define set_pte_at_notify set_pte_at