Re: [PATCH v2 4/4] selftests: mm: add mTHP collapse test cases

"Zi Yan" <[email protected]>
Newsgroups gmane.linux.kernel,gmane.linux.kernel.mm
Message-ID <[email protected]>
On Sat Aug 1, 2026 at 2:26 AM EDT, Baolin Wang wrote:
> Added a new command 'mthp_khugepaged' for mTHP collapse, along with the '-c'
> parameter to specify the collapse order. Additionally, added mTHP collapse
> test cases for 'collapse_full', 'collapse_empty', and 'collapse_single_mthp'
> for anonymous folios. All khugepaged test cases passed.
>
> Signed-off-by: Baolin Wang <[email protected]>
> ---
>  tools/testing/selftests/mm/khugepaged.c   | 130 ++++++++++++++++++----
>  tools/testing/selftests/mm/run_vmtests.sh |   2 +
>  2 files changed, 113 insertions(+), 19 deletions(-)
>
> diff --git a/tools/testing/selftests/mm/khugepaged.c b/tools/testing/selftests/mm/khugepaged.c
> index f69be6be0ecd..64d6da6aa90d 100644
> --- a/tools/testing/selftests/mm/khugepaged.c
> +++ b/tools/testing/selftests/mm/khugepaged.c
> @@ -26,9 +26,11 @@
>  
>  #define BASE_ADDR ((void *)(1UL << 30))
>  static unsigned long hpage_pmd_size;
> +static int hpage_pmd_order;
>  static unsigned long page_size;
>  static int hpage_pmd_nr;
>  static int anon_order;
> +static int collapse_order;

<snip>

>  
> diff --git a/tools/testing/selftests/mm/run_vmtests.sh b/tools/testing/selftests/mm/run_vmtests.sh
> index 687d115e3bd8..d09f9f6a384e 100755
> --- a/tools/testing/selftests/mm/run_vmtests.sh
> +++ b/tools/testing/selftests/mm/run_vmtests.sh
> @@ -410,6 +410,8 @@ CATEGORY="thp" run_test ./khugepaged all:shmem
>  
>  CATEGORY="thp" run_test ./khugepaged -s 4 all:shmem
>  
> +CATEGORY="thp" run_test ./khugepaged -c 4 mthp_khugepaged:anon

Why only testing collapse_order == 4? It is more useful to test all
possible mTHP orders. -c can accept common separated order and a range.


Why only testing mthp_khugepaged:anon? IIRC, file and shmem are not
supported, so khugepaged should reject them, right?


> +
>  # Try to create XFS if not provided
>  if [ -z "${SPLIT_HUGE_PAGE_TEST_XFS_PATH}" ]; then
>      if test_selected "thp"; then




-- 
Best Regards,
Yan, Zi
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.