On Sat, Aug 15, 2026 at 02:58:44AM +0100, Kiryl Shutsemau wrote:
> From: "Kiryl Shutsemau (Meta)" <[email protected]>
>
> collapse_compound_extreme() builds a PTE table full of distinct PTE-mapped
> compound pages by cycling hpage_pmd_nr fault-time THPs through mremap.  It
> therefore needs hpage_pmd_nr PMD-order allocations in a row.  That is fine
> at a 2M PMD (4K base pages) or a 32M one (16K).  A 512M PMD -- arm64 with
> 64K base pages -- makes each of those an order-13 allocation, which the
> allocator cannot reliably hand out even once, let alone 8192 times.
>
> The failure is not a quiet one: the case calls ksft_exit_fail_msg(), so the
> whole binary stops and every case after it is lost.
>
> Skip the case where the PMD is larger than 32M.  The MADV_COLLAPSE cases
> still cover PMD-order collapse on those configurations, and 4K and 16K
> PMDs are unaffected.
>
> Assisted-by: Claude-Code:claude-opus-5
> Reviewed-by: Mike Rapoport (Microsoft) <[email protected]>
> Tested-by: Muhammad Usama Anjum <[email protected]>
> Signed-off-by: Kiryl Shutsemau (Meta) <[email protected]>

Ah yeah again we are hit with the consequences of assumptions around PMD
size which do not apply for 64 KiB page size :)

Seems sensible to me so:

Acked-by: Lorenzo Stoakes (ARM) <[email protected]>

> ---
>  tools/testing/selftests/mm/khugepaged.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/tools/testing/selftests/mm/khugepaged.c 
> b/tools/testing/selftests/mm/khugepaged.c
> index 6cfec2b940ac..dd924edd8557 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -940,6 +940,16 @@ static void collapse_compound_extreme(struct 
> collapse_context *c, struct mem_ops
>       void *p;
>       int i;
>
> +     /*
> +      * The test needs hpage_pmd_nr PMD-order allocations, which is likely to
> +      * fail for large PMD sizes.  Skip if the PMD size is over 32M.
> +      */
> +     if (hpage_pmd_size > (32UL << 20)) {
> +             ksft_test_result_skip("%s: PMD too large for fault-time THP 
> construction\n",
> +                                   __func__);
> +             return;
> +     }
> +
>       p = ops->setup_area(1);
>       ksft_print_msg("Construct PTE page table full of different PTE-mapped 
> compound pages\n");
>       for (i = 0; i < hpage_pmd_nr; i++) {
> --
> 2.54.0
>

--
Cheers, Lorenzo

Reply via email to