userfaultfd: non-cooperative: add event for memory unmaps
When a non-cooperative userfaultfd monitor copies pages in the background, it may encounter regions that were already unmapped. Addition of UFFD_EVENT_UNMAP allows the uffd monitor to track precisely changes in the virtual memory layout. Since there might be different uffd contexts for the affected VMAs, we first should create a temporary representation for the unmap event for each uffd context and then notify them one by one to the appropriate userfault file descriptors. The event notification occurs after the mmap_sem has been released. [arnd@arndb.de: fix nommu build] Link: http://lkml.kernel.org/r/20170203165141.3665284-1-arnd@arndb.de [mhocko@suse.com: fix nommu build] Link: http://lkml.kernel.org/r/20170202091503.GA22823@dhcp22.suse.cz Link: http://lkml.kernel.org/r/1485542673-24387-3-git-send-email-rppt@linux.vnet.ibm.com Signed-off-by:Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by:
Michal Hocko <mhocko@suse.com> Signed-off-by:
Arnd Bergmann <arnd@arndb.de> Acked-by:
Hillf Danton <hillf.zj@alibaba-inc.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Cc: Pavel Emelyanov <xemul@virtuozzo.com> Signed-off-by:
Andrew Morton <akpm@linux-foundation.org> Signed-off-by:
Linus Torvalds <torvalds@linux-foundation.org>
Showing
- arch/mips/kernel/vdso.c 1 addition, 1 deletionarch/mips/kernel/vdso.c
- arch/tile/mm/elf.c 1 addition, 1 deletionarch/tile/mm/elf.c
- arch/x86/entry/vdso/vma.c 1 addition, 1 deletionarch/x86/entry/vdso/vma.c
- arch/x86/mm/mpx.c 2 additions, 2 deletionsarch/x86/mm/mpx.c
- fs/aio.c 1 addition, 1 deletionfs/aio.c
- fs/proc/vmcore.c 2 additions, 2 deletionsfs/proc/vmcore.c
- fs/userfaultfd.c 65 additions, 0 deletionsfs/userfaultfd.c
- include/linux/mm.h 9 additions, 5 deletionsinclude/linux/mm.h
- include/linux/userfaultfd_k.h 18 additions, 0 deletionsinclude/linux/userfaultfd_k.h
- include/uapi/linux/userfaultfd.h 3 additions, 0 deletionsinclude/uapi/linux/userfaultfd.h
- ipc/shm.c 4 additions, 4 deletionsipc/shm.c
- mm/mmap.c 31 additions, 15 deletionsmm/mmap.c
- mm/mremap.c 14 additions, 9 deletionsmm/mremap.c
- mm/nommu.c 4 additions, 3 deletionsmm/nommu.c
- mm/util.c 4 additions, 1 deletionmm/util.c
Loading
Please register or sign in to comment