Re: [PATCH v4 1/2] kselftest: mm: return fail when child test result is fail in khugepaged

From: Zi Yan

Date: Tue Sep 29 2026 - 11:42:27 EST


On 29 Sep 2026, at 6:33, Yeoreum Yun wrote:

> Although the child process in collapse_fork*() or collapse_max_ptes_shared()
> reports `KSFT_FAIL`, the result is ignored because the test only checks
> whether the parent’s page was collapsed into a huge page.
>
> As a result, the test is considered successful whenever the parent’s page
> is a huge page, even if the child test fails, as shown below:
>
> #
> # Run test: collapse_max_ptes_shared (khugepaged:anon)
> # Allocate huge page... OK
> # Share huge page over fork()... OK
> # Trigger CoW on page 1023 of 2048... OK
> # Maybe collapse with max_ptes_shared exceeded.... OK
> # Trigger CoW on page 1024 of 2048... Fail
> Bail out! Unexpected huge page
> # Planned tests != run tests (26 != 23)
> # Totals: pass:23 fail:0 xfail:0 xpass:0 skip:0 error:0 // child failed.
> # Check if parent still has huge page... OK // parent hpage success
> ok 24 collapse_max_ptes_shared // considered as success
> ...
> # Totals: pass:26 fail:0 xfail:0 xpass:0 skip:0 error:0
>
> To address this, propagate the child’s failure and skip the subsequent
> check in the parent.
>
> Reviewed-by: Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>
> Reviewed-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> Reviewed-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Signed-off-by: Yeoreum Yun <yeoreum.yun@xxxxxxx>
> ---
> tools/testing/selftests/mm/khugepaged.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Makes sense.

Acked-by: Zi Yan <ziy@xxxxxxxxxx>

Best Regards,
Yan, Zi