Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space
@ 2026-04-27 11:59 Wei Gao via ltp
  2026-04-27 12:26 ` Li Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Wei Gao via ltp @ 2026-04-27 11:59 UTC (permalink / raw)
  To: ltp

mmapstress06 is designed to stress the mfile_swap kernel primitive, which
manages shared anonymous memory. On architectures with large pages (like
64KB on ppc64le), the test's hardcoded request for 32769 pages results
in a ~2GB mapping. So in suse test system configured with 2GB of RAM and
no swap space, the test will fails with following information:

mmapstress06: errno = 12; large mmap failed
for this test to run, it needs a mmap space of
32769 pages

The failure occurs because the 2GB request cannot be fulfilled within
the 2GB RAM limit without swap backing. Since the test specifically
intends to exercise swap-related logic (mfile_swap), it should be skipped
with TCONF when the system lacks swap space.

Signed-off-by: Wei Gao <wegao@suse.com>
---
 testcases/kernel/mem/mmapstress/mmapstress06.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/testcases/kernel/mem/mmapstress/mmapstress06.c b/testcases/kernel/mem/mmapstress/mmapstress06.c
index 37b7edc84..54b5febbf 100644
--- a/testcases/kernel/mem/mmapstress/mmapstress06.c
+++ b/testcases/kernel/mem/mmapstress/mmapstress06.c
@@ -51,6 +51,8 @@ void ok_exit();
 
 #define ANON_GRAN_PAGES_MAX	(32U)
 
+#include "tst_memutils.h"
+
 extern time_t time(time_t *);
 extern char *ctime(const time_t *);
 extern int atoi(const char *);
@@ -74,6 +76,12 @@ int main(int argc, char *argv[])
 		(void)fprintf(stderr, "usage: %s sleep_time\n", argv[0]);
 		anyfail();
 	}
+
+	if (tst_available_swap() <= 0) {
+		tst_resm(TCONF, "Test requires swap space to exercise mfile_swap logic");
+		tst_exit();
+	}
+
 	(void)time(&t);
 //      (void)printf("%s: Started %s", argv[0], ctime(&t));  LTP Port
 	if (sbrk(pagesize - ((ulong) sbrk(0) & (pagesize - 1))) == (char *)-1) {
-- 
2.52.0


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

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

end of thread, other threads:[~2026-04-30  8:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-27 11:59 [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space Wei Gao via ltp
2026-04-27 12:26 ` Li Wang
2026-04-27 13:57   ` Wei Gao via ltp
2026-04-28  1:39     ` Li Wang
2026-04-27 13:57 ` [LTP] " linuxtestproject.agent
2026-04-28 11:52 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp
2026-04-28 12:58 ` Petr Vorel
2026-04-28 16:34   ` Petr Vorel
2026-04-29  2:22     ` Wei Gao via ltp
2026-04-29  6:10       ` Petr Vorel
2026-04-30  8:01       ` Li Wang

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