Hi all, This series fixes issues in the hugetlb and KSM MM selftest categories that can report failures when the prerequisites for the tests are not satisfied.
Patch 1 updates the hugetlb selftest helpers to handle -EINVAL when attempting to configure gigantic HugeTLB pages via nr_hugepages. PowerPC hash MMU pSeries systems expose gigantic hugepage sizes but do not allow runtime allocation of such pages, causing the sysfs write to fail. Handle this case gracefully and continue running the test instead of aborting. Patch 2 fixes the KSM NUMA merge test on systems with memoryless NUMA nodes. The test currently relies on the number of configured NUMA nodes and may attempt allocations on nodes that have no memory, resulting in spurious failures. Use the existing helpers to identify NUMA nodes that contain memory and skip the test when fewer than two such nodes are available. Patch 3 fixes a pre-existing operator precedence issue in ksm_tests, where a ternary expression combined with logical OR operators could be evaluated differently than intended. Added parentheses to ensure the correct evaluation order. These changes improve handling of unsupported test configurations and unmet test prerequisites, avoiding spurious failures. Thanks, Sayali --- V1 -> V2: - For "selftests/mm: handle EINVAL when configuring gigantic hugepages": Added a dedicated hugetlb_write_num() helper to handle the expected EINVAL returned by gigantic hugepage configuration, in the hugepage setup code rather than modifying the generic write_file() helper. - For "selftests/mm: fix ksm NUMA merge test for systems with memoryless NUMA nodes": Updated implementation as per David's review comment to build upon existing helpers get_next_mem_node(). - Added new patch "selftests/mm: fix ternary operator precedence in ksm_tests" to address a pre-existing issue identified during Sahiko's review. V1: https://lore.kernel.org/all/[email protected]/ --- Sayali Patil (3): selftests/mm: handle EINVAL when configuring gigantic hugepages selftests/mm: fix ksm NUMA merge test for systems with memoryless NUMA nodes selftests/mm: fix ternary operator precedence in ksm_tests .../testing/selftests/mm/hugepage_settings.c | 32 ++++++++++++++++++- .../testing/selftests/mm/hugepage_settings.h | 1 + tools/testing/selftests/mm/ksm_tests.c | 28 ++++++++-------- 3 files changed, 47 insertions(+), 14 deletions(-) -- 2.52.0

