From: David Hildenbrand <david@redhat.com>
To: Zi Yan <ziy@nvidia.com>, Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
baolin.wang@linux.alibaba.com, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/mm: directly add pagesize instead of increase until page size
Date: Mon, 1 Sep 2025 11:32:11 +0200 [thread overview]
Message-ID: <c89a9096-716a-4bbb-a911-99096ff8f0a0@redhat.com> (raw)
In-Reply-To: <E0C570E7-C4CD-4E41-9590-DDB64757CA2C@nvidia.com>
On 31.08.25 03:32, Zi Yan wrote:
> On 29 Aug 2025, at 22:31, Wei Yang wrote:
>
>> The check of is_backed_by_folio() is done on each page.
>>
>> Directly move pointer to next page instead of increase one and check if
>> it is page size aligned.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>> tools/testing/selftests/mm/split_huge_page_test.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/testing/selftests/mm/split_huge_page_test.c b/tools/testing/selftests/mm/split_huge_page_test.c
>> index 10ae65ea032f..7f7016ba4054 100644
>> --- a/tools/testing/selftests/mm/split_huge_page_test.c
>> +++ b/tools/testing/selftests/mm/split_huge_page_test.c
>> @@ -423,9 +423,8 @@ static void split_pte_mapped_thp(void)
>>
>> /* smap does not show THPs after mremap, use kpageflags instead */
>> thp_size = 0;
>> - for (i = 0; i < pagesize * 4; i++)
>> - if (i % pagesize == 0 &&
>> - is_backed_by_folio(&pte_mapped[i], pmd_order, pagemap_fd, kpageflags_fd))
>> + for (i = 0; i < pagesize * 4; i += pagesize)
>> + if (is_backed_by_folio(&pte_mapped[i], pmd_order, pagemap_fd, kpageflags_fd))
>> thp_size++;
>>
>> if (thp_size != 4)
>
> It might be better to add
>
> if (pte_mapped[i] != (char)i)
> ksft_exit_fail_msg("%ld byte corrupted\n", i);
>
> instead to make sure mremap() does not change pte_mapped[] values.
We do have a corruption check later in that function, so I think we can
just keep it simple here.
So this as is LGTM
Acked-by: David Hildenbrand <david@redhat.com>
As noted, we should just move from mremap() to mprotect() or sth like
that which has clearer semantics.
--
Cheers
David / dhildenb
next prev parent reply other threads:[~2025-09-01 9:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-30 2:31 Wei Yang
2025-08-30 3:09 ` Andrew Morton
2025-08-30 7:46 ` Wei Yang
2025-08-31 1:32 ` Zi Yan
2025-08-31 2:17 ` Wei Yang
2025-09-01 9:32 ` David Hildenbrand [this message]
2025-09-01 12:51 ` Wei Yang
2025-09-01 12:54 ` David Hildenbrand
2025-09-01 13:05 ` David Hildenbrand
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=c89a9096-716a-4bbb-a911-99096ff8f0a0@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=richard.weiyang@gmail.com \
--cc=ziy@nvidia.com \
/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