Patch series "mmu notifier contextual informations", v2.
This patchset adds contextual information, why an invalidation is
happening, to mmu notifier callback. This is necessary for user of mmu
notifier that wish to maintains their own data structure without having to
add new fields to struct vm_area_struct (vma).
For instance device can have they own page table that mirror the process
address space. When a vma is unmap (munmap() syscall) the device driver
can free the device page table for the range.
Today we do not have any information on why a mmu notifier call back is
happening and thus device driver have to assume that it is always an
munmap(). This is inefficient at it means that it needs to re-allocate
device page table on next page fault and rebuild the whole device driver
data structure for the range.
Other use case beside munmap() also exist, for instance it is pointless
for device driver to invalidate the device page table when the
invalidation is for the soft dirtyness tracking. Or device driver can
optimize away mprotect() that change the page table permission access for
This patchset enables all this optimizations for device drivers. I do not
include any of those in this series but another patchset I am posting will
The patchset is pretty simple from a code point of view. The first two
patches consolidate all mmu notifier arguments into a struct so that it is
easier to add/change arguments. The last patch adds the contextual
information (munmap, protection, soft dirty, clear, ...).
This patch (of 3):
To avoid having to change many callback definition everytime we want to
add a parameter use a structure to group all parameters for the
mmu_notifier invalidate_range_start/end callback. No functional changes
with this patch.
[firstname.lastname@example.org: fix drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c kerneldoc]
Link: http://email@example.comSigned-off-by: Jérôme Glisse <firstname.lastname@example.org>
Acked-by: Jan Kara <email@example.com>
Acked-by: Jason Gunthorpe <firstname.lastname@example.org> [infiniband]
Cc: Matthew Wilcox <email@example.com>
Cc: Ross Zwisler <firstname.lastname@example.org>
Cc: Dan Williams <email@example.com>
Cc: Paolo Bonzini <firstname.lastname@example.org>
Cc: Radim Krcmar <email@example.com>
Cc: Michal Hocko <firstname.lastname@example.org>
Cc: Christian Koenig <email@example.com>
Cc: Felix Kuehling <firstname.lastname@example.org>
Cc: Ralph Campbell <email@example.com>
Cc: John Hubbard <firstname.lastname@example.org>
Signed-off-by: Andrew Morton <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>