linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] hugetlb support for userfaultfd
@ 2016-06-06 17:45 Mike Kravetz
  2016-06-06 17:45 ` [RFC PATCH 1/6] mm/memory: add copy_huge_page_from_user for hugetlb userfaultfd support Mike Kravetz
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Mike Kravetz @ 2016-06-06 17:45 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Andrea Arcangeli, Hugh Dickins, Dave Hansen, Kirill A. Shutemov,
	Naoya Horiguchi, Hillf Danton, Michal Hocko, Andrew Morton,
	Mike Kravetz

With fallcoate hole punch now supported by hugetlbfs, users of this
functionality would like to catch subsequent faults to holes.  The
use case is based on a database model where:
- Many tasks map the same huegtlbfs file to provide a large shared area
- One management task determines that part of this area is no longer used
  and releases the associated pages by fallocate hole punch
- It is an error if any of the tasks fault on the hole
userfaultfd can be used to catch faults to the holes, and the application
can take appropriate action.

This patch set replicates the functionality of the existing userfaultfd
routines __mcopy_atomic and mcopy_atomic_pte with modifications for huge
pages.  The register/unregister routines are modified to accept hugetlb
vma's and a hook is added to huge page fault handling.  The existing
selftest is modified to work with huge pages so that the new code can be
exercised and tested.

To test the code with selftest, this patch is required:
https://lkml.org/lkml/2016/5/31/782

Some issues to consider in the RFC
- Is hugetlb.c the best place for hugetlb_mcopy_atomic_pte?
- Is there a better way to handle mmap_sem locking on entry/exit
  to __mcopy_atomic_hugetlb?
- Is there a better way to do huge page alignment/sanity checking
  in the register/unregister routines?  Unfortunately, we do not
  know we are dealing with huge pages until looking at the vma's.
- userfaultfd for hugepmd does not support UFFDIO_ZEROPAGE as there
  is no zero page support for huge pages (except THP case).
- Should there be another config option?  Support is now provided
  if both userfaultfd and hugetlb are configured.
- This has only been tested on x86, but the code should be arch
  independent.

Mike Kravetz (6):
  mm/memory: add copy_huge_page_from_user for hugetlb userfaultfd
    support
  mm/hugetlb: add hugetlb_mcopy_atomic_pte for userfaultfd support
  mm/userfaultfd: add __mcopy_atomic_hugetlb for huge page UFFDIO_COPY
  mm/hugetlb: add userfaultfd hugetlb hook
  fs/userfaultfd: allow registration of ranges containing huge pages
  selftests/userfaultfd: add userfaultfd_hugetlb test

 fs/userfaultfd.c                         |  69 +++++++++++-
 include/linux/hugetlb.h                  |   8 +-
 include/linux/mm.h                       |   3 +
 include/uapi/linux/userfaultfd.h         |   3 +
 mm/hugetlb.c                             | 102 ++++++++++++++++++
 mm/memory.c                              |  22 ++++
 mm/userfaultfd.c                         | 179 +++++++++++++++++++++++++++++++
 tools/testing/selftests/vm/Makefile      |   3 +
 tools/testing/selftests/vm/run_vmtests   |  13 +++
 tools/testing/selftests/vm/userfaultfd.c | 161 ++++++++++++++++++++++++---
 10 files changed, 540 insertions(+), 23 deletions(-)

-- 
2.4.11

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-06-07 16:35 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 17:45 [RFC PATCH 0/6] hugetlb support for userfaultfd Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 1/6] mm/memory: add copy_huge_page_from_user for hugetlb userfaultfd support Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 2/6] mm/hugetlb: add hugetlb_mcopy_atomic_pte for " Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 3/6] mm/userfaultfd: add __mcopy_atomic_hugetlb for huge page UFFDIO_COPY Mike Kravetz
2016-06-07  6:27   ` Hillf Danton
2016-06-07 16:35     ` Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 4/6] mm/hugetlb: add userfaultfd hugetlb hook Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 5/6] fs/userfaultfd: allow registration of ranges containing huge pages Mike Kravetz
2016-06-06 17:45 ` [RFC PATCH 6/6] selftests/userfaultfd: add userfaultfd_hugetlb test Mike Kravetz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).