mm/mmu_notifier: contextual information for event enums

CPU page table update can happens for many reasons, not only as a result
of a syscall (munmap(), mprotect(), mremap(), madvise(), ...) but also as
a result of kernel activities (memory compression, reclaim, migration,

This patch introduce a set of enums that can be associated with each of
the events triggering a mmu notifier.  Latter patches take advantages of
those enum values.

    - UNMAP: munmap() or mremap()
    - CLEAR: page table is cleared (migration, compaction, reclaim, ...)
    - PROTECTION_VMA: change in access protections for the range
    - PROTECTION_PAGE: change in access protections for page in the range
    - SOFT_DIRTY: soft dirtyness tracking

Being able to identify munmap() and mremap() from other reasons why the
page table is cleared is important to allow user of mmu notifier to update
their own internal tracking structure accordingly (on munmap or mremap it
is not longer needed to track range of virtual address as it becomes

Signed-off-by: Jérôme Glisse <>
Reviewed-by: Ralph Campbell <>
Reviewed-by: Ira Weiny <>
Cc: Christian König <>
Cc: Joonas Lahtinen <>
Cc: Jani Nikula <>
Cc: Rodrigo Vivi <>
Cc: Jan Kara <>
Cc: Andrea Arcangeli <>
Cc: Peter Xu <>
Cc: Felix Kuehling <>
Cc: Jason Gunthorpe <>
Cc: Ross Zwisler <>
Cc: Dan Williams <>
Cc: Paolo Bonzini <>
Cc: Radim Krcmar <>
Cc: Michal Hocko <>
Cc: Christian Koenig <>
Cc: John Hubbard <>
Cc: Arnd Bergmann <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
1 file changed