Add hugetlb MADV_DONTNEED support
Status from this message: [merged] userfaultfd-selftests-enable-hugetlb-remap-and-remove-event-testing.patch removed from -mm tree
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v3 Latest3 patches 3 repliesApplied 3/3
- v23 patches 13 repliesSuperseded
- v13 patches 4 repliesSuperseded
Changes in v3 from the cover letter
- Force start huge page alignment, extend length to huge page size. David
- Added more selftests to verify alignment.
- Remove double check for hugetlb vma. Peter
Patches in v3 All 3 applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/3 | mm: enable MADV_DONTNEED for hugetlb mappingsmm/ | +30 | 3 replies | Applied |
| 2/3 | selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_REMOVE testtools/ tools/ tools/ +1 more | +424 | 0 replies | Applied |
| 3/3 | userfaultfd/selftests: enable hugetlb remap and remove event testingtools/ tools/ | +36 | 0 replies | Applied |
Reviews trailers per patch
2 of 3 patches have a Reviewed-by or Acked-by.
| Patch | Shuah Khan | Axel Rasmussen |
|---|---|---|
| 1/3 | ||
| 2/3 | R-b | |
| 3/3 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH v3 0/3] Add hugetlb MADV_DONTNEED support
Userfaultfd selftests for hugetlb does not perform UFFD_EVENT_REMAP testing. However, mremap support was recently added in commit 550a7d60bd5e ("mm, hugepages: add mremap() support for hugepage backed vma"). While attempting to enable mremap support in the test, it was discovered that the mremap test indirectly depends on MADV_DONTNEED.
madvise does not allow MADV_DONTNEED for hugetlb mappings. However, that is primarily due to the check in can_madv_lru_vma(). By simply removing the check and adding huge page alignment, MADV_DONTNEED can be made to work for hugetlb mappings.
Do note that there is no compelling use case for adding this support. This was discussed in the RFC [1]. However, adding support makes sense as it is fairly trivial and brings hugetlb functionality more in line with 'normal' memory.
After enabling support, add selftest for MADV_DONTNEED as well as MADV_REMOVE. Then update userfaultfd selftest.
If new functionality is accepted, then madvise man page will be updated to indicate hugetlb is supported. It will also be updated to clarify what happens to the passed length argument.
v2 -> v3
- Force start huge page alignment, extend length to huge page size. David
- Added more selftests to verify alignment.
- Remove double check for hugetlb vma. Peter
v1 -> v2
- Use is_vm_hugetlb_page() instead of open coding vma hugetlb check.
- Add new test to .gitignore and use meaningful symbolic names (#define) for constants used in test. Shuah
- Updated help text in userfaultfd test and modified run_vmtests to not pass in a file for userfaultfd hugetlb test. Axel
- Added Reviewed-by for selftest patches.
RFC -> v1
- Fixed alignment issues when calling zap_page_range. Naoya
- Added checks for invalid arguments and misalignment to selftest.
[1] https://lore.kernel.org/linux-mm/[email protected]/
Mike Kravetz (3):
mm: enable MADV_DONTNEED for hugetlb mappings selftests/vm: add hugetlb madvise MADV_DONTNEED MADV_REMOVE test userfaultfd/selftests: enable hugetlb remap and remove event testing
mm/madvise.c | 33 +- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 1 + tools/testing/selftests/vm/hugetlb-madvise.c | 410 +++++++++++++++++++ tools/testing/selftests/vm/run_vmtests.sh | 15 +- tools/testing/selftests/vm/userfaultfd.c | 69 ++-- 6 files changed, 490 insertions(+), 39 deletions(-) create mode 100644 tools/testing/selftests/vm/hugetlb-madvise.c
Signature · 1 line
2.34.1