Skip to content

smaps / mm/gup: fix gup_can_follow_protnone fallout

David Hildenbrand kvm linux-fsdevel linux-kselftest linux-mm lkml stable 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest7 patches 5 repliesIn review 6 of 7 applied
  2. v28 patches 15 repliesSuperseded
  3. v14 patches 33 repliesSuperseded

Changes in v3 from the cover letter

* "mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT" -> Squash one comment removal
-> Adjust the KSM comment
* smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd() -> Move follow_trans_huge_pmd() to mm/internal.h

Patches in v3 6 of 7 applied

#Subject and filesSizeRepliesApplied
1/7mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULTinclude/linux/mm.h include/linux/mm_types.h mm/gup.c +1 more+49 -140 repliesApplied
2/7smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd()fs/proc/task_mmu.c include/linux/huge_mm.h mm/internal.h+8 -50 repliesApplied
3/7kvm: explicitly set FOLL_HONOR_NUMA_FAULT in hva_to_pfn_slow()virt/kvm/kvm_main.c+12 -10 repliesApplied
4/7mm/gup: don't implicitly set FOLL_HONOR_NUMA_FAULTmm/gup.c+0 -70 repliesApplied
5/7pgtable: improve pte_protnone() commentinclude/linux/pgtable.h+10 -60 repliesApplied
6/7selftest/mm: ksm_functional_tests: test in mmap_and_merge_range() if anything got mergedtools/testing/selftests/mm/ksm_functional_tests.c+47 -02 repliesApplied
7/7selftest/mm: ksm_functional_tests: Add PROT_NONE testtools/testing/selftests/mm/ksm_functional_tests.c+52 -73 replies

Reviews trailers per patch

5 of 7 patches have a Reviewed-by or Acked-by.

PatchMel GormanPeter Xu
1/7A-b A-b
2/7A-b
3/7
4/7
5/7A-b
6/7A-b
7/7A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/7] smaps / mm/gup: fix gup_can_follow_protnone fallout

This is agains mm/mm-unstable, but everything except patch #6 and #7 should apply on current master. Especially patch #1 and #2 should go upstream first, so we can let the other stuff mature a bit longer.

Handle the fallout of 474098edac26 ("mm/gup: replace FOLL_NUMA by gup_can_follow_protnone()") where I accidentially missed that follow_page() and smaps implicitly kept the FOLL_NUMA flag clear by not setting it if FOLL_FORCE is absent, to not trigger faults on PROT_NONE-mapped PTEs.

Patch #1 fixes the known issues by reintroducing FOLL_NUMA as FOLL_HONOR_NUMA_FAULT and decoupling it from FOLL_FORCE.

Patch #2 is a cleanup that I think actually fixes some corner cases, so I added a Fixes: tag.

Patch #3 makes KVM explicitly set FOLL_HONOR_NUMA_FAULT in the single case where it is required, and documents the situation.

Patch #4 then stops implicitly setting FOLL_HONOR_NUMA_FAULT. But note that for FOLL_WRITE we always implicitly honor NUMA hinting faults.

Patch #5 cleans up a comments.

Patch #6 improves the KVM functional tests such that patch #7 can actually check for one of the known issues: KSM no longer working on PROT_NONE mappings on x86-64 with CONFIG_NUMA_BALANCING.

v2 -> V3:
* "mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT" -> Squash one comment removal
-> Adjust the KSM comment
* smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd() -> Move follow_trans_huge_pmd() to mm/internal.h

Cc Andrew Morton <[email protected]>
Cc Linus Torvalds <[email protected]>
Cc Peter Xu <[email protected]>
Cc Matthew Wilcox <[email protected]>
Cc Hugh Dickins <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc John Hubbard <[email protected]>
Cc Mel Gorman <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Paolo Bonzini <[email protected]>

David Hildenbrand (7):
mm/gup: reintroduce FOLL_NUMA as FOLL_HONOR_NUMA_FAULT
smaps: use vm_normal_page_pmd() instead of follow_trans_huge_pmd()
kvm: explicitly set FOLL_HONOR_NUMA_FAULT in hva_to_pfn_slow() mm/gup: don't implicitly set FOLL_HONOR_NUMA_FAULT
pgtable: improve pte_protnone() comment
selftest/mm: ksm_functional_tests: test in mmap_and_merge_range() if
anything got merged
selftest/mm: ksm_functional_tests: Add PROT_NONE test

 fs/proc/task_mmu.c                            |   3 +-
 include/linux/huge_mm.h                       |   3 -
 include/linux/mm.h                            |  21 +++-
 include/linux/mm_types.h                      |   9 ++
 include/linux/pgtable.h                       |  16 ++-
 mm/gup.c                                      |  23 +++-
 mm/huge_memory.c                              |   3 +-
 mm/internal.h                                 |   7 ++
 .../selftests/mm/ksm_functional_tests.c       | 106 ++++++++++++++++--
 virt/kvm/kvm_main.c                           |  13 ++-
 10 files changed, 171 insertions(+), 33 deletions(-)
Signature · 1 line
2.41.0