Re: [PATCH 09/16] selftests/mm: skip khugepaged swap tests when no swap is configured

Mike Rapoport <[email protected]> Mon, 03 Aug 2026 14:04:23 +0300
Newsgroups org.kernel.vger.linux-kselftest,org.kernel.vger.linux-kernel,org.kvack.linux-mm
Message-ID <178575506332.1561566.7690482774981947944.b4-review@b4>
> collapse_swapin_single_pte and collapse_max_ptes_swap swap pages out with
> MADV_PAGEOUT and then require them to be swapped. With no swap area
> configured MADV_PAGEOUT is a no-op, so check_swap() finds nothing and the
> tests report a failure that only reflects the environment, not khugepaged.
> 
> Skip both when /proc/swaps shows no swap area, so a missing swap device
> yields a SKIP rather than a spurious failure. A real swap-out failure with
> swap present still fails as before.
> 
> Assisted-by: Claude-Code:claude-opus-5
> Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>
>
> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
> index b43e060b4118..b074b005b62f 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -181,6 +181,21 @@ static void get_finfo(const char *dir)
>  	ksft_exit_fail_msg("%s: Could not read: %s\n", __func__, path);
>  }
>  
> +static bool has_swap(void)

Would be usefull in vm_util.

-- 
Sincerely yours,
Mike.