Skip to content

RFC get_user_pages() for dax mappings

Dan Williams linux-mm linux-nvdimm nvdimm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest5 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5mm, dax, pmem: introduce {get|put}_dev_pagemap() for dax-gupdrivers/nvdimm/pmem.c include/linux/mm.h include/linux/mm_types.h +1 more+105 -80 replies
2/5mm, dax: dax-pmd vs thp-pmd vs hugetlbfs-pmdarch/ia64/include/asm/pgtable.h arch/sh/include/asm/pgtable-3level.h arch/x86/include/asm/pgtable.h +3 more+22 -160 replies
3/5mm, x86: get_user_pages() for dax mappingsarch/x86/mm/gup.c include/linux/huge_mm.h include/linux/mm.h +3 more+179 -330 replies
4/5dax: provide diagnostics for pmd mapping failuresfs/dax.c+38 -90 replies
5/5dax: re-enable dax pmd mappingsfs/Kconfig fs/dax.c+4 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/5] get_user_pages() for dax mappings

Following up on the kernel summit tech topic presentation of ZONE_DEVICE, here is a re-post of dax-gup support patches. Originally posted back in September [1], this reduced set represents the core of the implementation and the changes most in need of review from -mm developers.

[1]: https://lists.01.org/pipermail/linux-nvdimm/2015-September/002199.html

---

To date, we have implemented two I/O usage models for persistent memory, PMEM (a persistent "ram disk") and DAX (mmap persistent memory into userspace). This series adds a third, DAX-GUP, that allows DAX mappings to be the target of direct-i/o. It allows userspace to coordinate DMA/RDMA from/to persitent memory.

The implementation leverages the ZONE_DEVICE mm-zone that went into 4.3-rc1 (also discussed at kernel summit) to flag pages that are owned and dynamically mapped by a device driver. The pmem driver, after mapping a persistent memory range into the system memmap via devm_memremap_pages(), arranges for DAX to distinguish pfn-only versus page-backed pmem-pfns via flags in the new pfn_t type.

The DAX code, upon seeing a PFN_DEV+PFN_MAP flagged pfn, flags the resulting pte(s) inserted into the process page tables with a new _PAGE_DEVMAP flag. Later, when get_user_pages() is walking ptes it keys off _PAGE_DEVMAP to pin the device hosting the page range active. Finally, get_page() and put_page() are modified to take references against the device driver established page mapping.

The full set in context with other changes is available here:

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/nvdimm libnvdimm-pending

A test to prove out the pmd path is here:

https://github.com/pmem/ndctl/blob/master/lib/test-dax-pmd.c

---

Dan Williams (5):
mm, dax, pmem: introduce {get|put}_dev_pagemap() for dax-gup mm, dax: dax-pmd vs thp-pmd vs hugetlbfs-pmd
mm, x86: get_user_pages() for dax mappings
dax: provide diagnostics for pmd mapping failures
dax: re-enable dax pmd mappings

 arch/ia64/include/asm/pgtable.h      |    1 
 arch/sh/include/asm/pgtable-3level.h |    1 
 arch/x86/include/asm/pgtable.h       |    2 -
 arch/x86/mm/gup.c                    |   56 +++++++++++++++++++-
 drivers/nvdimm/pmem.c                |    6 +-
 fs/Kconfig                           |    3 +
 fs/dax.c                             |   55 ++++++++++++++-----
 include/linux/huge_mm.h              |   13 ++++-
 include/linux/mm.h                   |   89 ++++++++++++++++++++++++++-----
 include/linux/mm_types.h             |    5 ++
 kernel/memremap.c                    |   53 +++++++++++++++++--
 mm/gup.c                             |   17 ++++++
 mm/huge_memory.c                     |   97 +++++++++++++++++++++++++---------
 mm/memory.c                          |    8 +--
 mm/swap.c                            |   15 +++++
 15 files changed, 348 insertions(+), 73 deletions(-)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>