On 21/05/26 12:03, Sayali Patil wrote:

Hi all,

Powerpc systems with a 64K base page size exposed several issues while
running mm selftests. Some tests assume specific hugetlb configurations,
use incorrect interfaces, or fail instead of skipping when the required
kernel features are not available.

This series fixes these issues and improves test robustness.

Please review the patches and provide any feedback or suggestions for
improvement.

Thanks,
Sayali

---
v6->v7
   - Rebased onto the latest mm-new branch, top commit of the base is
     commit 0cec77cfd531 ("mm/filemap: fix page_cache_prev_miss() when no hole is 
found")
   - Dropped "selftest/mm: align memory size to huge page size in
     hugepage-mremap test":
     Similar patch has already been merged.
   - For "selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero":
     Changed format specifier of bytes to %zu as per review
     comment.
   - For "selftests/mm: move hwpoison setup into run_test() and silence
     modprobe output for memory-failure category":
     Added condition to avoid executing the test pipeline for skipped tests and 
assign
     ret directly.

v6: https://lore.kernel.org/all/[email protected]/
---
v5->v6
   - For "selftests/mm: restore default nr_hugepages value via exit trap
     in charge_reserved_hugetlb.sh":
     Extended trap to include INT and TERM in hugetlb tests to ensure
     nr_hugepages is restored on signal-based exits.
   - For "selftests/mm: restore default nr_hugepages value via exit trap
     in hugetlb_reparenting_test.sh":
     Extended trap to include INT and TERM in hugetlb tests to ensure
     nr_hugepages is restored on signal-based exits.
   - For "selftests/mm: fix cgroup task placement and drop memory.current
     checks in hugetlb_reparenting_test.sh":
     Updated the subshell invocation to pass variables as positional arguments
     instead of interpolating them into the command string as per review 
comment.
   - For "selftests/mm: move hwpoison setup into run_test() and silence modprobe
     output for memory-failure category":
     Updated the condition to avoid unconditional module removal and ensures it 
is
     only unloaded if loaded by the test.

v5: https://lore.kernel.org/all/[email protected]/
---
---
v4->v5
   - For "selftests/mm: move hwpoison setup into run_test() and silence modprobe
     output for memory-failure category":
     Renamed LOADED_MOD to LOADED_HWPOISON_INJECT_MOD as per review comment.
   - Dropped "selftests/cgroup: extend test_hugetlb_memcg.c to support all huge
     page sizes":
     Due to intermittent failures observed on some systems.
   - Added Tested-by from Venkat for all patches.
   - Added Reviewed-by from Zi yan for patches 7,8 and 13.
   - Added Acked-by from Zi yan for patches 1 and 3.

v4: https://lore.kernel.org/all/[email protected]/
---
v3->v4

   - selftests/mm: restore default nr_hugepages value via EXIT
     trap in charge_reserved_hugetlb.sh:
     Updated to use an EXIT trap to restore the original nr_hugepages
     once at script termination, ensuring reliable restoration on all
     exit paths.

   - selftest/mm: fix cgroup task placement and drop memory.current checks
     in hugetlb_reparenting_test.sh:
     Updated to use a deterministic synchronization method by migrating the
     workload process within a wrapper subshell before calling exec() to
     ensure correct cgroup accounting.

   - selftest/mm: align memory size to huge page size in hugepage-mremap
     test:
     Update test code directly to align memory allocations to the hugepage
     size, rather than modifying run_vmtests.sh. This replaces the previous
     commit “adjust hugepage-mremap test size for large huge pages” with
     a cleaner, direct approach in the test itself.

   - selftests/mm: ensure destination is hugetlb-backed in hugepage-mremap:
     Updated to remove MAP_POPULATE flag for the mmap call as per review
     comment.

   - selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported:
     Updated as per review comment to initialize features to zero and exit
     on all uffd_get_features() failures, avoiding spurious test errors.

   - selftests/mm: move hwpoison setup into run_test() and silence
     modprobe output for memory-failure category:
     Declared LOADED_MOD as local variable and avoided a redundant
     skip message when the module is not found.
     Updated logic to set exitcode to ksft_skip only when no failure has
     been recorded.

   - selftests/cgroup: extend test_hugetlb_memcg.c to support all huge
     page sizes:
     Updated to skip on memory constraints instead of returning
     EXIT_FAILURE.
     Updated the logic to fully account for the scenario when the
     per-CPU stock is empty and a refill charges MEMCG_CHARGE_BATCH.
     Updated to avoid overflow on 32-bit systems for memory.max value.

   - Included "selftests/mm: restore default nr_hugepages value via
     EXIT trap in hugetlb_reparenting_test.sh"

   - Included "selftests/mm: free dynamically allocated PMD-sized
     buffers in split_huge_page_test"

   - Included "selftests/mm: clarify alternate unmapping in compaction_test"

   - Dropped "selftests/mm: fix double increment in linked list cleanup in
     compaction_test":
     The behaviour is intentional.

v3: https://lore.kernel.org/all/[email protected]/

---
v2->v3
   - selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported:
     Rename function to check_uffd_wp_feature_supported() as suggested in 
review.
   - selftest/mm: fix cgroup task placement and drop memory.current checks
     in hugetlb_reparenting_test.sh:
     Drop memory.current validation from the hugetlb reparenting test.
     Keep tolerance at 7MB (reverting earlier increase to 8MB in v1).
   - Included "selftests/mm: allow PUD-level entries in compound testcase of hmm
     tests" patch:
     Extend the compound testcase checks to accept PUD-level mappings.
   - Included "selftests/mm: replace hardcoded THP size with runtime PMD page 
size in
     hmm tests" patch:
     Use read_pmd_pagesize() instead of TWOMEG and cap maximum THPs in
     benchmarks to avoid integer overflow.

v2: https://lore.kernel.org/all/[email protected]/

---
v1->v2
   - For "selftests/mm: ensure destination is hugetlb-backed in 
hugepage-mremap":
     update FLAGS definition to MAP_HUGETLB | MAP_SHARED | MAP_POPULATE and
     used it for mmap() calls as suggested during review.

v1: https://lore.kernel.org/all/[email protected]/
---

Sayali Patil (13):
   selftests/mm: restore default nr_hugepages value via exit trap in
     charge_reserved_hugetlb.sh
   selftests/mm: fix hugetlb pathname construction in
     charge_reserved_hugetlb.sh
   selftests/mm: restore default nr_hugepages value via exit trap in
     hugetlb_reparenting_test.sh
   selftests/mm: fix hugetlb pathname construction in
     hugetlb_reparenting_test.sh
   selftests/mm: fix cgroup task placement and drop memory.current checks
     in hugetlb_reparenting_test.sh
   selftests/mm: size tmpfs according to PMD page size in
     split_huge_page_test
   selftests/mm: free dynamically allocated PMD-sized buffers in
     split_huge_page_test
   selftest/mm: register existing mapping with userfaultfd in
     hugetlb-mremap
   selftests/mm: ensure destination is hugetlb-backed in hugetlb-mremap
   selftests/mm: skip uffd-wp-mremap if UFFD write-protect is unsupported
   selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero
   selftests/mm: move hwpoison setup into run_test() and silence modprobe
     output for memory-failure category
   selftests/mm: clarify alternate unmapping in compaction_test

  .../selftests/mm/charge_reserved_hugetlb.sh   | 45 +++++++++-----
  tools/testing/selftests/mm/compaction_test.c  |  3 +
  tools/testing/selftests/mm/hugetlb-mremap.c   | 32 +++-------
  .../selftests/mm/hugetlb_reparenting_test.sh  | 60 +++++++++---------
  tools/testing/selftests/mm/run_vmtests.sh     | 62 ++++++++++++-------
  .../selftests/mm/split_huge_page_test.c       | 27 +++++---
  tools/testing/selftests/mm/uffd-stress.c      |  6 +-
  tools/testing/selftests/mm/uffd-wp-mremap.c   | 13 ++++
  8 files changed, 151 insertions(+), 97 deletions(-)

Hi Andrew,

I checked the AI review comments. Most of them appear to be relatively minor.

I have sent one fixup patch ("selftests/mm: use ksft_exit_skip() instead of KSFT_SKIP in uffd-stress") for the comment in "selftests/mm: skip uffd-stress test when nr_pages_per_cpu is zero". The remaining comments were either already discussed earlier or can be addressed later if needed.

Please let me know if you have any additional comments or concerns.

Thanks,
Sayali

Reply via email to