From: Zi Yan <ziy@nvidia.com>
To: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org,
liam@infradead.org, nico.pache@linux.dev, dev.jain@arm.com,
ryan.roberts@arm.com, baohua@kernel.org, lance.yang@linux.dev,
usama.arif@linux.dev, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] selftests: mm: add mTHP collapse test cases
Date: Wed, 05 Aug 2026 22:04:16 -0400 [thread overview]
Message-ID: <C9F48004-554F-4264-ACD7-E514360D73AE@nvidia.com> (raw)
In-Reply-To: <e17f9ee5-6606-46a4-a756-9d7a5462cd45@linux.alibaba.com>
On 5 Aug 2026, at 21:30, Baolin Wang wrote:
> On 8/6/26 9:25 AM, Zi Yan wrote:
>> On 5 Aug 2026, at 21:17, Baolin Wang wrote:
>>
>>> On 8/6/26 12:46 AM, Zi Yan wrote:
>>>> 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 <baolin.wang@linux.alibaba.com>
>>>>> ---
>>>>> 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.
>>>
>>> This also follows the previous '-s' parameter configuration, which is used to specify the mTHP order allocation.
>>>
>>> I think specifying a single order size already tests the overall mTHP collapse
>>
>> Got it. If a single order covers the flow, I am fine with it.
>>
>>> flow, so I'm not sure whether testing all orders is worthwhile. Maybe I can add a few more orders?
>>> ./khugepaged -c 2 mthp_khugepaged:anon
>>> ./khugepaged -c 4 mthp_khugepaged:anon
>>> ./khugepaged -c 8 mthp_khugepaged:anon
>>>
>>>> Why only testing mthp_khugepaged:anon? IIRC, file and shmem are not
>>>> supported, so khugepaged should reject them, right?
>>>
>>> Currently, I have not added test cases for shmem mTHP collapse, so adding file or shmem would be no-ops and might mislead others. I will add the shmem/file mTHP collapse feature and test cases in a following patchset.
>>
>> Right. I mean when one specifies ./khugepaged mthp_khugepaged:file/shmem, the
>> program should show some error like “file/shmem not supported”.
>
> Yes, that works too. I still prefer to add the corresponding test cases after I add shmem mTHP collapse support:)
Sure. Or update usage() to print “mthp_khugepaged only supports anon”. You
can remove that after you add other support types.
>
> But if you have a strong opinion on this, I can also add a "not supported" message first.
Best Regards,
Yan, Zi
next prev parent reply other threads:[~2026-08-06 2:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-01 6:26 [PATCH v2 0/4] add anon mTHP collapse test cases Baolin Wang
2026-08-01 6:26 ` [PATCH v2 1/4] selftests: mm: extend the check_huge() to support mTHP check Baolin Wang
2026-08-04 20:38 ` Nico Pache (Red Hat)
2026-08-05 15:31 ` Zi Yan
2026-08-06 0:47 ` Baolin Wang
2026-08-01 6:26 ` [PATCH v2 2/4] selftests: mm: move gather_after_split_folio_orders() into vm_util.c file Baolin Wang
2026-08-04 20:38 ` Nico Pache (Red Hat)
2026-08-05 15:32 ` Zi Yan
2026-08-01 6:26 ` [PATCH v2 3/4] selftests: mm: implement the mTHP-sized hugepage check helpers Baolin Wang
2026-08-04 20:38 ` Nico Pache (Red Hat)
2026-08-05 15:59 ` Zi Yan
2026-08-06 1:08 ` Baolin Wang
2026-08-01 6:26 ` [PATCH v2 4/4] selftests: mm: add mTHP collapse test cases Baolin Wang
2026-08-04 20:38 ` Nico Pache (Red Hat)
2026-08-05 16:46 ` Zi Yan
2026-08-06 1:17 ` Baolin Wang
2026-08-06 1:25 ` Zi Yan
2026-08-06 1:30 ` Baolin Wang
2026-08-06 2:04 ` Zi Yan [this message]
2026-08-06 2:09 ` Baolin Wang
2026-08-04 20:38 ` [PATCH v2 0/4] add anon " Nico Pache (Red Hat)
2026-08-05 5:08 ` Baolin Wang
2026-08-05 15:14 ` Kiryl Shutsemau
2026-08-06 1:19 ` Baolin Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=C9F48004-554F-4264-ACD7-E514360D73AE@nvidia.com \
--to=ziy@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=lance.yang@linux.dev \
--cc=liam@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=nico.pache@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=usama.arif@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox