Thread (5 messages) 5 messages, 2 authors, 2018-12-13

[PATCH v3 0/3] mmu notifier contextual informations

flat view
STALE2873d

From: <hidden>
Date: 2018-12-13 17:13:44
Also in: dri-devel, kvm, linux-fsdevel, lkml
Subsystem: char and misc drivers, drm drivers, filesystem direct access (dax), filesystems (vfs and infrastructure), hmm - heterogeneous memory management, hugetlb subsystem, infiniband subsystem, intel drm i915 driver (meteor lake, dg2 and older excluding poulsbo, moorestown and derivative), kernel virtual machine (kvm), memory management, memory management - core, memory management - ksm (kernel samepage merging), memory management - migration, memory management - oom killer, memory management - rmap (reverse mapping), memory management - thp (transparent huge page), memory mapping, memory mapping - madvise (memory advice), performance events subsystem, proc filesystem, radeon and amdgpu drm drivers, the rest, uprobes, xen hypervisor interface · Maintainers: Arnd Bergmann, Greg Kroah-Hartman, David Airlie, Simona Vetter, Dan Williams, Alexander Viro, Christian Brauner, Jason Gunthorpe, Leon Romanovsky, Muchun Song, Oscar Salvador, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, Paolo Bonzini, Andrew Morton, David Hildenbrand, Michal Hocko, Lorenzo Stoakes, Liam R. Howlett, Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Alex Deucher, Christian König, Linus Torvalds, Masami Hiramatsu, Oleg Nesterov, Juergen Gross, Stefano Stabellini

Revision v3 (3 revisions archived).

Revisions (3)
  1. v1
  2. v2 [diff against previous]
  3. v3 current [diff against previous]
From: Jérôme Glisse <redacted>

Changes since v2:
 - fix build warning with CONFIG_MMU_NOTIFIER=n
 - fix make htmldocs warning

Changes since v1:
 - fix build with CONFIG_MMU_NOTIFIER=n
 - kernel docs


Original cover letter:

This patchset add 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 the range.

This patchset enable all this optimizations for device driver.
I do not include any of those in this serie but other patchset
i am posting will leverage this.

From code point of view the patchset is pretty simple, 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,
...).

Cheers,
Jérôme

Cc: Christian König <christian.koenig@amd.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Jason Gunthorpe <redacted>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Matthew Wilcox <redacted>
Cc: Ross Zwisler <zwisler@kernel.org>
Cc: Dan Williams <redacted>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <redacted>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Ralph Campbell <redacted>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: <redacted>
Cc: <redacted>
Cc: <redacted>
Cc: <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>

Jérôme Glisse (3):
  mm/mmu_notifier: use structure for invalidate_range_start/end callback
    v2
  mm/mmu_notifier: use structure for invalidate_range_start/end calls v3
  mm/mmu_notifier: contextual information for event triggering
    invalidation v2

 drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c  |  47 ++++-----
 drivers/gpu/drm/i915/i915_gem_userptr.c |  14 ++-
 drivers/gpu/drm/radeon/radeon_mn.c      |  16 ++-
 drivers/infiniband/core/umem_odp.c      |  20 ++--
 drivers/infiniband/hw/hfi1/mmu_rb.c     |  13 +--
 drivers/misc/mic/scif/scif_dma.c        |  11 +-
 drivers/misc/sgi-gru/grutlbpurge.c      |  14 ++-
 drivers/xen/gntdev.c                    |  12 +--
 fs/dax.c                                |  15 ++-
 fs/proc/task_mmu.c                      |   8 +-
 include/linux/mm.h                      |   4 +-
 include/linux/mmu_notifier.h            | 132 ++++++++++++++++++------
 kernel/events/uprobes.c                 |  11 +-
 mm/hmm.c                                |  23 ++---
 mm/huge_memory.c                        |  58 +++++------
 mm/hugetlb.c                            |  54 +++++-----
 mm/khugepaged.c                         |  11 +-
 mm/ksm.c                                |  23 ++---
 mm/madvise.c                            |  22 ++--
 mm/memory.c                             | 103 +++++++++---------
 mm/migrate.c                            |  29 +++---
 mm/mmu_notifier.c                       |  22 ++--
 mm/mprotect.c                           |  16 +--
 mm/mremap.c                             |  11 +-
 mm/oom_kill.c                           |  17 +--
 mm/rmap.c                               |  32 +++---
 virt/kvm/kvm_main.c                     |  14 +--
 27 files changed, 406 insertions(+), 346 deletions(-)

-- 
2.17.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help