[PATCH v4 00/15] selftests/mm: fix failures and robustness improvements

Venkat venkat88 at linux.ibm.com
Tue Apr 7 23:08:46 AEST 2026


Hi Sayali,

I tested the full series, and overall it looks good. In particular, the
series resolves the issue reported in v2 [1], and the other patches in
the series behaved as expected during my testing.

[1]: https://lore.kernel.org/all/cf815c21-138e-44c8-986d-d8496503ee32@linux.ibm.com/

The only concern I observed is specific to patch 15/15. On systems using
1GB huge pages, I noticed below failure.

  ./test_hugetlb_memcg
  # Hugepage size: 1048576 kB
  # memory usage should go back down.
  # expected memory: 4194304
  # actual memory:   8388608
  not ok 1 test_hugetlb_memcg

Apart from this case, the rest of the series tested cleanly for me. Based
on that, it seems that dropping patch 15/15 independently makes sense.

Hence for the series,

Tested-by: Venkat Rao Bagalkote <venkat88 at linux.ibm.com>

Regards,
Venkat

> On 6 Apr 2026, at 2:49 PM, Sayali Patil <sayalip at linux.ibm.com> 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
> 
> ---
> 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/cover.1774591179.git.sayalip@linux.ibm.com/
> 
> ---
> 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/cover.1773305677.git.sayalip@linux.ibm.com/
> 
> ---
> 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/cover.1773134177.git.sayalip@linux.ibm.com/
> ---
> 
> Sayali Patil (15):
>  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: align memory size to huge page size in hugepage-mremap
>    test
>  selftest/mm: register existing mapping with userfaultfd in
>    hugepage-mremap
>  selftests/mm: ensure destination is hugetlb-backed in hugepage-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/cgroup: extend test_hugetlb_memcg.c to support all huge page
>    sizes
> 
> .../selftests/cgroup/test_hugetlb_memcg.c     | 90 ++++++++++++++-----
> .../selftests/mm/charge_reserved_hugetlb.sh   | 45 ++++++----
> tools/testing/selftests/mm/compaction_test.c  |  3 +
> tools/testing/selftests/mm/hugepage-mremap.c  | 42 ++++-----
> .../selftests/mm/hugetlb_reparenting_test.sh  | 59 ++++++------
> tools/testing/selftests/mm/run_vmtests.sh     | 52 +++++++----
> .../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 +++
> 9 files changed, 220 insertions(+), 117 deletions(-)
> 
> -- 
> 2.52.0
> 



More information about the Linuxppc-dev mailing list