Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Guangming Wang <guangming.wang@windriver.com>
To: guangming.wang@windriver.com
Cc: stable@vger.kernel.org, Zi Yan <ziy@nvidia.com>,
	Zach O'Keefe <zokeefe@google.com>,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 6.1.y v2] selftests/vm: fix split huge page tests
Date: Fri, 30 May 2025 12:51:40 +0800	[thread overview]
Message-ID: <20250530045140.3838342-1-guangming.wang@windriver.com> (raw)

From: Zi Yan <ziy@nvidia.com>

[ upstream commit dd63bd7df41a8f9393a2e3ff9157a441c08eb996  ]

Fix two inputs to check_anon_huge() and one if condition, so the tests
work as expected.

Steps to reproduce the issue.
make headers
make -C tools/testing/selftests/vm

Before patching:test fails with a non-zero exit code

~/linux$ sudo tools/testing/selftests/vm/split_huge_page_test \
> /dev/null 2>&1;echo $?
1

~/linux$ ./split_huge_page_test
No THP is allocated

After patching:

~/linux$ sudo tools/testing/selftests/vm/split_huge_page_test \
> /dev/null 2>&1;echo $?
0

~/linux$ sudo tools/testing/selftests/vm/split_huge_page_test
Split huge pages successful
...

Link: https://lkml.kernel.org/r/20230306160907.16804-1-zi.yan@sent.com
Fixes: c07c343cda8e ("selftests/vm: dedup THP helpers")
Cc: stable@vger.kernel.org
Signed-off-by: Zi Yan <ziy@nvidia.com>
Reviewed-by: Zach O'Keefe <zokeefe@google.com>
Tested-by: Zach O'Keefe <zokeefe@google.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Guangming Wang <guangming.wang@windriver.com>
---
 tools/testing/selftests/vm/split_huge_page_test.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/vm/split_huge_page_test.c b/tools/testing/selftests/vm/split_huge_page_test.c
index 76e1c36dd..b8558c7f1 100644
--- a/tools/testing/selftests/vm/split_huge_page_test.c
+++ b/tools/testing/selftests/vm/split_huge_page_test.c
@@ -106,7 +106,7 @@ void split_pmd_thp(void)
 	for (i = 0; i < len; i++)
 		one_page[i] = (char)i;
 
-	if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
+	if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
 		printf("No THP is allocated\n");
 		exit(EXIT_FAILURE);
 	}
@@ -122,7 +122,7 @@ void split_pmd_thp(void)
 		}
 
 
-	if (check_huge_anon(one_page, 0, pmd_pagesize)) {
+	if (!check_huge_anon(one_page, 0, pmd_pagesize)) {
 		printf("Still AnonHugePages not split\n");
 		exit(EXIT_FAILURE);
 	}
@@ -169,7 +169,7 @@ void split_pte_mapped_thp(void)
 	for (i = 0; i < len; i++)
 		one_page[i] = (char)i;
 
-	if (!check_huge_anon(one_page, 1, pmd_pagesize)) {
+	if (!check_huge_anon(one_page, 4, pmd_pagesize)) {
 		printf("No THP is allocated\n");
 		exit(EXIT_FAILURE);
 	}
-- 
2.34.1


             reply	other threads:[~2025-05-30  4:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30  4:51 Guangming Wang [this message]
2025-06-01  9:37 ` [PATCH 6.1.y v2] selftests/vm: fix split huge page tests Sasha Levin
2025-06-02  9:29 ` Greg KH

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=20250530045140.3838342-1-guangming.wang@windriver.com \
    --to=guangming.wang@windriver.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=ziy@nvidia.com \
    --cc=zokeefe@google.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