Re: [PATCH v5 05/19] selftests/mm: make the swap cases' swapout reliable
From: Baolin Wang
Date: Wed Sep 09 2026 - 05:04:20 EST
On 9/8/26 8:50 PM, Kiryl Shutsemau wrote:
From: "Kiryl Shutsemau (Meta)" <kas@xxxxxxxxxx>
collapse_swapin_single_pte() and collapse_max_ptes_swap() swap a range out
and then require smaps to report exactly the count they asked for. Two
things keep that count from arriving.
MADV_PAGEOUT is best effort, so the count often turns up a moment late.
And wait_for_scan() leaves the range eligible for collapsing, so
khugepaged is still working on it. Collapsing reads the swapped-out pages
back in, so the daemon empties the swap as fast as the case fills it. On
arm64 with 64K pages max_ptes_swap is 1024 pages, which is 64M a step, and
the case loses the race:
# Swapout 1024 of 8192 pages... Fail
not ok 10 collapse_max_ptes_swap
Retry for up to two seconds, holding the range out of khugepaged's reach
meanwhile. The collapse each case runs next restores MADV_HUGEPAGE, so
only the setup is affected.
If the pages still won't swap out, skip: no swap, swap too small or full,
a memcg cap or busy writeback. None of that is a kernel bug.
Assisted-by: LLM
Reviewed-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
Tested-by: Muhammad Usama Anjum <usama.anjum@xxxxxxx>
Signed-off-by: Kiryl Shutsemau (Meta) <kas@xxxxxxxxxx>
---
Make sense to me. So
Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>