> The mTHP collapse cases only run when the caller names both the context
> and an order, so a plain ./khugepaged covers the PMD contexts on anon and
> nothing else.  run_vmtests.sh pinned order 4 and covered no other.
> 
> Run the mTHP cases once per supported anon THP order below the PMD when
> -c is absent, and pull that context into both the no-argument invocation
> and "all".  Around that:
> 
>   - -c still pins one order, and now says what is wrong instead of
>     printing the usage text.  An order at or below the -s source order is
>     skipped: the sources would already be the size being asked for.
> 
>   - Both orders end up as array indices and shift counts, so -s and -c
>     are range-checked before they get there.
> 
>   - The mTHP context has only anon cases, so a run that names a different
>     mem_type -- "all:shmem", say -- drops it again rather than refusing
>     to start.  Naming both explicitly still refuses.
> 
>   - A case carries the order it was registered at, so a result names it:
> 
>       # Run test: collapse_single_mthp (mthp_khugepaged:anon, order 6)
> 
> On x86-64 with 4K pages that is orders 2 through 8, and ./khugepaged goes
> from 28 results to 77 in 21 seconds, so run_vmtests.sh can drop its
> pinned order-4 line.
> 
> Assisted-by: Claude-Code:claude-opus-5
> Tested-by: Muhammad Usama Anjum <[email protected]>
> 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 1d357143258a..ba3dc1718e28 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -31,6 +31,9 @@ static unsigned long page_size;
>  static int hpage_pmd_nr;
>  static int anon_order;
>  static int collapse_order;
> +static bool collapse_order_given;

Maybe _set?  _defined? But surely not given ;-)

-- 
Sincerely yours,
Mike.


Reply via email to