linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: directly add pagesize instead of increase until page size
@ 2025-08-30  2:31 Wei Yang
  2025-08-30  3:09 ` Andrew Morton
  2025-08-31  1:32 ` Zi Yan
  0 siblings, 2 replies; 9+ messages in thread
From: Wei Yang @ 2025-08-30  2:31 UTC (permalink / raw)
  To: akpm, david, lorenzo.stoakes, ziy, baolin.wang
  Cc: linux-mm, linux-kselftest, Wei Yang

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)
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-09-01 13:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-30  2:31 [PATCH] selftests/mm: directly add pagesize instead of increase until page size 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
2025-09-01 12:51     ` Wei Yang
2025-09-01 12:54       ` David Hildenbrand
2025-09-01 13:05         ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).