[PATCH v3 0/5] selftests/mm: skip several tests when thp is not available

Chunyu Hu posted 5 patches 2 weeks, 6 days ago
There is a newer version of this series
tools/testing/selftests/mm/guard-regions.c    |  4 ++++
tools/testing/selftests/mm/soft-dirty.c       |  4 +++-
.../selftests/mm/split_huge_page_test.c       | 19 ++++-----------
tools/testing/selftests/mm/thp_settings.c     | 24 +------------------
tools/testing/selftests/mm/thp_settings.h     |  1 -
tools/testing/selftests/mm/transhuge-stress.c |  4 ++++
tools/testing/selftests/mm/vm_util.c          | 16 +++++++++++++
tools/testing/selftests/mm/vm_util.h          |  2 ++
8 files changed, 34 insertions(+), 40 deletions(-)
[PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Chunyu Hu 2 weeks, 6 days ago
There are several tests requires transprarent hugepages, when run on thp
disabled kernel such as realtime kernel, there will be false negative.
Mark those tests as skip when thp is not available.

Changes in v3:
  - patch 1 update commit message to show the log snippet with where the
    fail happens, change the 'false positive' to 'false negative'.
    Update reviwed by
  - patch 2 update reviewed-by
  - patch 3 make write_file to void return
  - patch 4 and patch 5 updated reviewed-by/acked-by

Changes in v2:
  - replace 'false postive' with 'false negative' in cover letter
  - patch 1 and patch 2 add reviewed-by/acked-by
  - new patch 3 to add write_file() in vm_util as a common helper
  - patch 4 removed the {} in if block, removed the write_file helper
    rename chunk in v1. Add reviewed-by
  - patch 5 move the exit chunk to the front of ksft_print_headers() as
    suggested by David.  Add review by.

Chunyu Hu (5):
  selftests/mm/guard-regions: skip collapse test when thp not enabled
  selftests/mm: soft-dirty: skip two tests when thp is not available
  selftests/mm: move write_file helper to vm_util
  selftests/mm: split_huge_page_test: skip the test when thp is not
    available
  selftests/mm: transhuge_stress: skip the test when thp not available

 tools/testing/selftests/mm/guard-regions.c    |  4 ++++
 tools/testing/selftests/mm/soft-dirty.c       |  4 +++-
 .../selftests/mm/split_huge_page_test.c       | 19 ++++-----------
 tools/testing/selftests/mm/thp_settings.c     | 24 +------------------
 tools/testing/selftests/mm/thp_settings.h     |  1 -
 tools/testing/selftests/mm/transhuge-stress.c |  4 ++++
 tools/testing/selftests/mm/vm_util.c          | 16 +++++++++++++
 tools/testing/selftests/mm/vm_util.h          |  2 ++
 8 files changed, 34 insertions(+), 40 deletions(-)


base-commit: f338e77383789c0cae23ca3d48adcc5e9e137e3c
-- 
2.53.0
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Andrew Morton 2 weeks, 6 days ago
On Tue, 17 Mar 2026 17:44:14 +0800 Chunyu Hu <chuhu@redhat.com> wrote:

> There are several tests requires transprarent hugepages, when run on thp
> disabled kernel such as realtime kernel, there will be false negative.
> Mark those tests as skip when thp is not available.

AI review asked some questions:
https://sashiko.dev/#/patchset/20260317094419.1429259-1-chuhu%40redhat.com
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Chunyu Hu 2 weeks, 5 days ago
On Tue, Mar 17, 2026 at 11:37:30AM -0700, Andrew Morton wrote:
> On Tue, 17 Mar 2026 17:44:14 +0800 Chunyu Hu <chuhu@redhat.com> wrote:
> 
> > There are several tests requires transprarent hugepages, when run on thp
> > disabled kernel such as realtime kernel, there will be false negative.
> > Mark those tests as skip when thp is not available.
> 
> AI review asked some questions:
> https://sashiko.dev/#/patchset/20260317094419.1429259-1-chuhu%40redhat.com

Hi Andrew,

Nice tool.
 
For question one. In guard-region test, collapse tests are for checking
collapse is denied when operating on guard region, not for checking
madvise(MADV_COLLAPSE) will fail when thp is setup to 'never with sysfs,
result is same, but it's a different test. Maybe we don't have strong
interest to test when thp is set to 'never' in this collapse test.
Do you perfer we let it run when thp is setup with 'never'?

For question two. In soft dirty test. Yes, test_mprotect skip logic has
similar issue when open failed. 'Bail out' would be shown. Maybe we
do this in other series or you prefer me to fix it in this series?

For question three. Add buffer length check in write_file() helper and
check if written bytes equal expected bytes. It's easy to add a buffer
lenghth check and make it robust. It's not easy to do the partial
written check as that will make the helper more complex and need one
more parameter as expected written bytes. Maybe for such question, we
should do with other series, not in this one?

Thanks!
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by David Hildenbrand (Arm) 2 weeks, 5 days ago
On 3/18/26 10:22, Chunyu Hu wrote:
> On Tue, Mar 17, 2026 at 11:37:30AM -0700, Andrew Morton wrote:
>> On Tue, 17 Mar 2026 17:44:14 +0800 Chunyu Hu <chuhu@redhat.com> wrote:
>>
>>> There are several tests requires transprarent hugepages, when run on thp
>>> disabled kernel such as realtime kernel, there will be false negative.
>>> Mark those tests as skip when thp is not available.
>>
>> AI review asked some questions:
>> https://sashiko.dev/#/patchset/20260317094419.1429259-1-chuhu%40redhat.com
> 
> Hi Andrew,
> 
> Nice tool.
>  
> For question one. In guard-region test, collapse tests are for checking
> collapse is denied when operating on guard region, not for checking
> madvise(MADV_COLLAPSE) will fail when thp is setup to 'never with sysfs,
> result is same, but it's a different test. Maybe we don't have strong
> interest to test when thp is set to 'never' in this collapse test.
> Do you perfer we let it run when thp is setup with 'never'?
> 
> For question two. In soft dirty test. Yes, test_mprotect skip logic has
> similar issue when open failed. 'Bail out' would be shown. Maybe we
> do this in other series or you prefer me to fix it in this series?

IMHO, that's something for another series (if at all).

> 
> For question three. Add buffer length check in write_file() helper and
> check if written bytes equal expected bytes. It's easy to add a buffer
> lenghth check and make it robust. It's not easy to do the partial
> written check as that will make the helper more complex and need one
> more parameter as expected written bytes. Maybe for such question, we
> should do with other series, not in this one?

The AI brings up many things that are irrelevant in practice (in
particular for tests). So I wouldn't worry about that. You are only
moving code.

-- 
Cheers,

David
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Chunyu Hu 2 weeks, 4 days ago
On Wed, Mar 18, 2026 at 01:07:03PM +0100, David Hildenbrand (Arm) wrote:
> On 3/18/26 10:22, Chunyu Hu wrote:
> > On Tue, Mar 17, 2026 at 11:37:30AM -0700, Andrew Morton wrote:
> >> On Tue, 17 Mar 2026 17:44:14 +0800 Chunyu Hu <chuhu@redhat.com> wrote:
> >>
> >>> There are several tests requires transprarent hugepages, when run on thp
> >>> disabled kernel such as realtime kernel, there will be false negative.
> >>> Mark those tests as skip when thp is not available.
> >>
> >> AI review asked some questions:
> >> https://sashiko.dev/#/patchset/20260317094419.1429259-1-chuhu%40redhat.com
> > 
> > Hi Andrew,
> > 
> > Nice tool.
> >  
> > For question one. In guard-region test, collapse tests are for checking
> > collapse is denied when operating on guard region, not for checking
> > madvise(MADV_COLLAPSE) will fail when thp is setup to 'never with sysfs,
> > result is same, but it's a different test. Maybe we don't have strong
> > interest to test when thp is set to 'never' in this collapse test.
> > Do you perfer we let it run when thp is setup with 'never'?
> > 
> > For question two. In soft dirty test. Yes, test_mprotect skip logic has
> > similar issue when open failed. 'Bail out' would be shown. Maybe we
> > do this in other series or you prefer me to fix it in this series?
> 
> IMHO, that's something for another series (if at all).

OK. Then will not touch it here.

> 
> > 
> > For question three. Add buffer length check in write_file() helper and
> > check if written bytes equal expected bytes. It's easy to add a buffer
> > lenghth check and make it robust. It's not easy to do the partial
> > written check as that will make the helper more complex and need one
> > more parameter as expected written bytes. Maybe for such question, we
> > should do with other series, not in this one?
> 
> The AI brings up many things that are irrelevant in practice (in
> particular for tests). So I wouldn't worry about that. You are only
> moving code.

Yes. Then I don't change it here. Thanks.

> 
> -- 
> Cheers,
> 
> David
>
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Lorenzo Stoakes (Oracle) 2 weeks, 5 days ago
On Wed, Mar 18, 2026 at 05:22:40PM +0800, Chunyu Hu wrote:
> For question one. In guard-region test, collapse tests are for checking
> collapse is denied when operating on guard region, not for checking
> madvise(MADV_COLLAPSE) will fail when thp is setup to 'never with sysfs,

No, if thp is set to never, madvise(MADV_COLLAPSE) still succeeds. This is a
source of confusion for many :)

> result is same, but it's a different test. Maybe we don't have strong
> interest to test when thp is set to 'never' in this collapse test.
> Do you perfer we let it run when thp is setup with 'never'?

Yes because it should still function then :)

Cheers, Lorenzo
Re: [PATCH v3 0/5] selftests/mm: skip several tests when thp is not available
Posted by Chunyu Hu 2 weeks, 4 days ago
On Wed, Mar 18, 2026 at 11:32:10AM +0000, Lorenzo Stoakes (Oracle) wrote:
> On Wed, Mar 18, 2026 at 05:22:40PM +0800, Chunyu Hu wrote:
> > For question one. In guard-region test, collapse tests are for checking
> > collapse is denied when operating on guard region, not for checking
> > madvise(MADV_COLLAPSE) will fail when thp is setup to 'never with sysfs,
> 
> No, if thp is set to never, madvise(MADV_COLLAPSE) still succeeds. This is a
> source of confusion for many :)

You are right. Thanks for correcting me.

> 
> > result is same, but it's a different test. Maybe we don't have strong
> > interest to test when thp is set to 'never' in this collapse test.
> > Do you perfer we let it run when thp is setup with 'never'?
> 
> Yes because it should still function then :)

Sure. Let me send a v4 to change to thp_available().

> 
> Cheers, Lorenzo
>