[nacked] selftests-mm-skip-khugepaged-swap-tests-without-swap.patch removed from -mm tree
Andrew Morton <[email protected]>
| Newsgroups | org.kernel.vger.mm-commits |
|---|---|
| Message-ID | <[email protected]> |
The quilt patch titled
Subject: selftests/mm: skip khugepaged swap tests without swap
has been removed from the -mm tree. Its filename was
selftests-mm-skip-khugepaged-swap-tests-without-swap.patch
This patch was dropped because it was nacked
------------------------------------------------------
From: Muhammad Usama Anjum <[email protected]>
Subject: selftests/mm: skip khugepaged swap tests without swap
Date: Mon, 27 Jul 2026 10:52:19 +0100
collapse_swapin_single_pte and collapse_max_ptes_swap require MADV_PAGEOUT
to replace anonymous pages with swap entries. On swapless systems there
is no backing store with which to create those entries, so check_swap()
reports missing setup rather than broken khugepaged behavior.
Swapless configurations are common on Android and other constrained test
devices. Failing these cases obscures actionable results from the rest of
the khugepaged suite.
Check /proc/swaps before either swap-dependent case and skip when no
active swap area exists. With swap present, retain the existing
MADV_PAGEOUT and swap-entry assertions unchanged.
Print each existing swapout diagnostic before the prerequisite check so
skip() completes a KTAP diagnostic line instead of emitting an unprefixed
message.
Link: https://lore.kernel.org/[email protected]
Signed-off-by: Muhammad Usama Anjum <[email protected]>
Cc: Baolin Wang <[email protected]>
Cc: Barry Song <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Dev Jain <[email protected]>
Cc: Lance Yang <[email protected]>
Cc: Liam R. Howlett <[email protected]>
Cc: Lorenzo Stoakes <[email protected]>
Cc: Miaohe Lin <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Naoya Horiguchi <[email protected]>
Cc: Nico Pache <[email protected]>
Cc: Ryan Roberts <[email protected]>
Cc: Sarthak Sharma <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: Suren Baghdasaryan <[email protected]>
Cc: Usama Arif <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Zi Yan <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
---
tools/testing/selftests/mm/khugepaged.c | 38 ++++++++++++++++++++--
1 file changed, 36 insertions(+), 2 deletions(-)
--- a/tools/testing/selftests/mm/khugepaged.c~selftests-mm-skip-khugepaged-swap-tests-without-swap
+++ a/tools/testing/selftests/mm/khugepaged.c
@@ -103,6 +103,28 @@ static void skip(const char *msg)
exit_status = KSFT_SKIP;
}
+static bool is_swap_enabled(void)
+{
+ char buf[MAX_LINE_LENGTH];
+ FILE *file;
+ bool enabled = false;
+
+ file = fopen("/proc/swaps", "r");
+ if (!file)
+ return false;
+
+ if (!fgets(buf, sizeof(buf), file))
+ goto out;
+
+ /* Check for first active swap entry. */
+ if (fgets(buf, sizeof(buf), file))
+ enabled = true;
+
+out:
+ fclose(file);
+ return enabled;
+}
+
static void save_settings(void)
{
ksft_print_msg("Save THP and khugepaged settings...");
@@ -821,10 +843,16 @@ static void collapse_swapin_single_pte(s
{
void *p;
+ ksft_print_msg("Swapout one page...");
+ if (!is_swap_enabled()) {
+ skip("No active swap");
+ ksft_test_result_report(exit_status, "%s\n", __func__);
+ return;
+ }
+
p = ops->setup_area(1);
ops->fault(p, 0, hpage_pmd_size);
- ksft_print_msg("Swapout one page...");
if (madvise(p, page_size, MADV_PAGEOUT))
ksft_exit_fail_perror("madvise(MADV_PAGEOUT)");
if (check_swap(p, page_size)) {
@@ -847,10 +875,16 @@ static void collapse_max_ptes_swap(struc
int max_ptes_swap = thp_read_num("khugepaged/max_ptes_swap");
void *p;
+ ksft_print_msg("Swapout %d of %d pages...", max_ptes_swap + 1, hpage_pmd_nr);
+ if (!is_swap_enabled()) {
+ skip("No active swap");
+ ksft_test_result_report(exit_status, "%s\n", __func__);
+ return;
+ }
+
p = ops->setup_area(1);
ops->fault(p, 0, hpage_pmd_size);
- ksft_print_msg("Swapout %d of %d pages...", max_ptes_swap + 1, hpage_pmd_nr);
if (madvise(p, (max_ptes_swap + 1) * page_size, MADV_PAGEOUT))
ksft_exit_fail_perror("madvise(MADV_PAGEOUT)");
if (check_swap(p, (max_ptes_swap + 1) * page_size)) {
_
Patches currently in -mm which might be from [email protected] are
selftests-mm-skip-cow-tmpfile-cases-when-fallocate-is-unsupported.patch
selftests-mm-skip-guard-hole-punch-test-if-madv_remove-is-unsupported.patch
selftests-mm-skip-hard-dirty-page-cache-test-on-nfs.patch
selftests-mm-retry-migration-failures-for-the-full-runtime.patch