public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Fix hugeshmat05 test failure on lpar with 1GB hugepages.
@ 2026-04-20 10:23 Pavithra
  2026-04-20 10:53 ` [LTP] " linuxtestproject.agent
  0 siblings, 1 reply; 2+ messages in thread
From: Pavithra @ 2026-04-20 10:23 UTC (permalink / raw)
  To: ltp; +Cc: pavrampu

Modified the test to detect large hugepage sizes (≥1GB) and adjust test sizes accordingly.

Signed-off-by: Pavithra <pavrampu@linux.ibm.com>
---
 .../mem/hugetlb/hugeshmat/hugeshmat05.c       | 30 ++++++++++++++-----
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
index 3b2ae351c..c1e34f999 100644
--- a/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
+++ b/testcases/kernel/mem/hugetlb/hugeshmat/hugeshmat05.c
@@ -37,9 +37,13 @@ void setup(void)
 {
 	page_size = getpagesize();
 	hpage_size = SAFE_READ_MEMINFO("Hugepagesize:") * 1024;
+
+	tst_res(TINFO, "Page size: %ld bytes", page_size);
+	tst_res(TINFO, "Hugepage size: %ld bytes (%ld MB)",
+		hpage_size, hpage_size / (1024 * 1024));
 }
 
-void shm_test(int size)
+void shm_test(long size)
 {
 	int shmid;
 	char *shmaddr;
@@ -56,7 +60,7 @@ void shm_test(int size)
 	}
 
 	shmaddr[0] = 1;
-	tst_res(TINFO, "allocated %d huge bytes", size);
+	tst_res(TINFO, "allocated %ld huge bytes", size);
 
 	if (shmdt((const void *)shmaddr) != 0) {
 		shmctl(shmid, IPC_RMID, NULL);
@@ -69,13 +73,23 @@ void shm_test(int size)
 static void test_hugeshmat(void)
 {
 	unsigned int i;
+	long multiplier;
+	long tst_sizes[4];
+
+	/*
+	 * For large hugepage sizes (e.g., 1GB), use N/2 multiplier to avoid
+	 * excessive memory requirements (4GB for N=4 with 1GB pages) while
+	 * still testing alignment boundary conditions with multiple pages.
+	 */
+	if (hpage_size >= 1024 * 1024 * 1024)
+		multiplier = N / 2;
+	else
+		multiplier = N;
 
-	const int tst_sizes[] = {
-		N * hpage_size - page_size,
-		N * hpage_size - page_size - 1,
-		hpage_size,
-		hpage_size + 1
-	};
+	tst_sizes[0] = multiplier * hpage_size - page_size;
+	tst_sizes[1] = multiplier * hpage_size - page_size - 1;
+	tst_sizes[2] = hpage_size;
+	tst_sizes[3] = hpage_size + 1;
 
 	for (i = 0; i < ARRAY_SIZE(tst_sizes); ++i)
 		shm_test(tst_sizes[i]);
-- 
2.53.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2026-04-20 10:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-20 10:23 [LTP] [PATCH] Fix hugeshmat05 test failure on lpar with 1GB hugepages Pavithra
2026-04-20 10:53 ` [LTP] " linuxtestproject.agent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox