* [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* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 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-27 13:57 ` [LTP] " linuxtestproject.agent ` (2 subsequent siblings) 3 siblings, 1 reply; 11+ messages in thread From: Li Wang @ 2026-04-27 12:26 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, Wei Gao via ltp wrote: > 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. Since we do have MAKE_SWAPFILE_SIZE macros, I guess we could create a dedicated swap-file for the testing on those system? And, it'd be appreciated if you can convert it into new LTP API. -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-27 12:26 ` Li Wang @ 2026-04-27 13:57 ` Wei Gao via ltp 2026-04-28 1:39 ` Li Wang 0 siblings, 1 reply; 11+ messages in thread From: Wei Gao via ltp @ 2026-04-27 13:57 UTC (permalink / raw) To: ltp > Hi Wei, > > Wei Gao via ltp wrote: > > > 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. > > Since we do have MAKE_SWAPFILE_SIZE macros, I guess we could create > a dedicated swap-file for the testing on those system? Sorry forget mention this failure happen in our Immutable/Transactional systems test (default disable swap), i am not sure enable swap force do test is make sense or not. @Petr Should we skip this test for transactional system? > > And, it'd be appreciated if you can convert it into new LTP API. No problem from my side. > > -- > Regards, > Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-27 13:57 ` Wei Gao via ltp @ 2026-04-28 1:39 ` Li Wang 0 siblings, 0 replies; 11+ messages in thread From: Li Wang @ 2026-04-28 1:39 UTC (permalink / raw) To: Wei Gao; +Cc: ltp On Mon, Apr 27, 2026 at 01:57:28PM +0000, Wei Gao via ltp wrote: > > > Hi Wei, > > > > Wei Gao via ltp wrote: > > > > > 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. > > > > Since we do have MAKE_SWAPFILE_SIZE macros, I guess we could create > > a dedicated swap-file for the testing on those system? > Sorry forget mention this failure happen in our Immutable/Transactional > systems test (default disable swap), i am not sure enable swap force do > test is make sense or not. Ok, if that system does not support swap on purpose, that we can do the skip. Reviewed-by: Li Wang <li.wang@linux.dev> -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] mmapstress06: TCONF on systems without swap space 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 ` linuxtestproject.agent 2026-04-28 11:52 ` [LTP] [PATCH v1] " Andrea Cervesato via ltp 2026-04-28 12:58 ` Petr Vorel 3 siblings, 0 replies; 11+ messages in thread From: linuxtestproject.agent @ 2026-04-27 13:57 UTC (permalink / raw) To: Wei Gao; +Cc: ltp, LTP AI Reviewer Hi Wei, On Mon, 27 Apr 2026, Wei Gao wrote: > mmapstress06: TCONF on systems without swap space > +#include "tst_memutils.h" Minor nit: the include lands after the #define ANON_GRAN_PAGES_MAX block rather than with the other #includes at the top. Consider moving it into the existing LTP include block for consistency. > + if (tst_available_swap() <= 0) { > + tst_resm(TCONF, "Test requires swap space to exercise mfile_swap logic"); > + tst_exit(); > + } Reviewed-by: LTP AI Reviewer <ltp-ai@noreply.github.com> --- Note: Our agent completed the review of the patch. The full review can be found at: https://github.com/linux-test-project/ltp-agent/actions/runs/24999033042 The agent can sometimes produce false positives although often its findings are genuine. If you find issues with the review, please comment this email or ignore the suggestions. Regards, LTP AI Reviewer -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 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 ` [LTP] " linuxtestproject.agent @ 2026-04-28 11:52 ` Andrea Cervesato via ltp 2026-04-28 12:58 ` Petr Vorel 3 siblings, 0 replies; 11+ messages in thread From: Andrea Cervesato via ltp @ 2026-04-28 11:52 UTC (permalink / raw) To: Wei Gao via ltp; +Cc: ltp Reviewed-by: Andrea Cervesato <andrea.cervesato@suse.com> -- Andrea Cervesato SUSE QE Automation Engineer Linux andrea.cervesato@suse.com -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-27 11:59 [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space Wei Gao via ltp ` (2 preceding siblings ...) 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 3 siblings, 1 reply; 11+ messages in thread From: Petr Vorel @ 2026-04-28 12:58 UTC (permalink / raw) To: Wei Gao; +Cc: Li Wang, ltp Hi all, > 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"); Why to require swap for the test instead of checking for ENOMEM later? > + tst_exit(); nit: I'd use tst_brkm() although it has ugly "Remaining cases broken" message as it will be more obvious when doing rewrite. > + } How about this? (with cleanup of ugly printf). Kind regards, Petr +++ testcases/kernel/mem/mmapstress/mmapstress06.c @@ -89,10 +89,12 @@ int main(int argc, char *argv[]) (mmapaddr, (ANON_GRAN_PAGES_MAX * NMFPTEPG + 1) * pagesize, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, 0) == (caddr_t) - 1) { - ERROR("large mmap failed"); - printf("for this test to run, it needs a mmap space of\n"); - printf("%d pages\n", (ANON_GRAN_PAGES_MAX * NMFPTEPG + 1)); - return 1; + if (errno == ENOMEM) { + tst_brkm(TCONF, NULL, "not enough memory or swap for mmap() %d pages", + ANON_GRAN_PAGES_MAX * NMFPTEPG + 1); + } + + tst_brkm(TBROK | TERRNO, NULL, "mmap() failed"); } (void)sleep(sleep_time); (void)time(&t); -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-28 12:58 ` Petr Vorel @ 2026-04-28 16:34 ` Petr Vorel 2026-04-29 2:22 ` Wei Gao via ltp 0 siblings, 1 reply; 11+ messages in thread From: Petr Vorel @ 2026-04-28 16:34 UTC (permalink / raw) To: Wei Gao, Li Wang, ltp Hi all, > Hi all, > > mmapstress06 is designed to stress the mfile_swap kernel primitive, which Uh, I overlooked "mfile_swap kernel primitive". Then the approach would make sense, but is it really true? mfile_swap does not exist any more, not even in a git log. Test was added in January 2003, e.g. even before 2.6. > > 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: I'm not really sure. if that's caused by missing swap or would it work on machine with RAM big enough which has swap disabled (I guess you retest with e.g. 8 GB RAM). Otherwise I'd prefer prefer to deal with errno ENOMEM (12) instead (as I pointed out previously). Kind regards, Petr > > 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 ++++++++ ... > > + if (tst_available_swap() <= 0) { > > + tst_resm(TCONF, "Test requires swap space to exercise mfile_swap logic"); > Why to require swap for the test instead of checking for ENOMEM later? > > + tst_exit(); > nit: I'd use tst_brkm() although it has ugly "Remaining cases broken" message as > it will be more obvious when doing rewrite. > > + } > How about this? (with cleanup of ugly printf). > Kind regards, > Petr > +++ testcases/kernel/mem/mmapstress/mmapstress06.c > @@ -89,10 +89,12 @@ int main(int argc, char *argv[]) > (mmapaddr, (ANON_GRAN_PAGES_MAX * NMFPTEPG + 1) * pagesize, > PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, 0, > 0) == (caddr_t) - 1) { > - ERROR("large mmap failed"); > - printf("for this test to run, it needs a mmap space of\n"); > - printf("%d pages\n", (ANON_GRAN_PAGES_MAX * NMFPTEPG + 1)); > - return 1; > + if (errno == ENOMEM) { > + tst_brkm(TCONF, NULL, "not enough memory or swap for mmap() %d pages", > + ANON_GRAN_PAGES_MAX * NMFPTEPG + 1); > + } > + > + tst_brkm(TBROK | TERRNO, NULL, "mmap() failed"); > } > (void)sleep(sleep_time); > (void)time(&t); -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 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 0 siblings, 2 replies; 11+ messages in thread From: Wei Gao via ltp @ 2026-04-29 2:22 UTC (permalink / raw) To: Petr Vorel; +Cc: Li Wang, ltp On Tue, Apr 28, 2026 at 06:34:15PM +0200, Petr Vorel wrote: > Hi all, > > > Hi all, > > > > mmapstress06 is designed to stress the mfile_swap kernel primitive, which > Uh, I overlooked "mfile_swap kernel primitive". Then the approach would make > sense, but is it really true? mfile_swap does not exist any more, not even in a > git log. Test was added in January 2003, e.g. even before 2.6. > > > > 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: > > I'm not really sure. if that's caused by missing swap or would it work on > machine with RAM big enough which has swap disabled (I guess you retest with > e.g. 8 GB RAM). Otherwise I'd prefer prefer to deal with errno ENOMEM (12) > instead (as I pointed out previously). > Base description/implementation of test case, The original test is "passive," merely creating a mapping and relying on external processes to trigger swapping(case has sleep_time parameter). Further more, this case is "ghost test" for current kernel, it do mmap but never writes to it, so kernel never actually allocated memory, Together with current obsolete logic(test targets legcy mfile_swap) i suggest just delete it instead of wasting time patching(refactor) it. What do you think? @Petr @wang li? -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-29 2:22 ` Wei Gao via ltp @ 2026-04-29 6:10 ` Petr Vorel 2026-04-30 8:01 ` Li Wang 1 sibling, 0 replies; 11+ messages in thread From: Petr Vorel @ 2026-04-29 6:10 UTC (permalink / raw) To: Wei Gao; +Cc: Li Wang, ltp > On Tue, Apr 28, 2026 at 06:34:15PM +0200, Petr Vorel wrote: > > Hi all, > > > Hi all, > > > > mmapstress06 is designed to stress the mfile_swap kernel primitive, which > > Uh, I overlooked "mfile_swap kernel primitive". Then the approach would make > > sense, but is it really true? mfile_swap does not exist any more, not even in a > > git log. Test was added in January 2003, e.g. even before 2.6. > > > > 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: > > I'm not really sure. if that's caused by missing swap or would it work on > > machine with RAM big enough which has swap disabled (I guess you retest with > > e.g. 8 GB RAM). Otherwise I'd prefer prefer to deal with errno ENOMEM (12) > > instead (as I pointed out previously). > Base description/implementation of test case, The original test is "passive," merely creating a > mapping and relying on external processes to trigger swapping(case has sleep_time parameter). > Further more, this case is "ghost test" for current kernel, it do mmap but never > writes to it, so kernel never actually allocated memory, > Together with current obsolete logic(test targets legcy mfile_swap) i suggest just delete > it instead of wasting time patching(refactor) it. What do you think? @Petr @wang li? I'm ok with deleting, but i hope others will have look on it as well. Kind regards, Petr -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [LTP] [PATCH v1] mmapstress06: TCONF on systems without swap space 2026-04-29 2:22 ` Wei Gao via ltp 2026-04-29 6:10 ` Petr Vorel @ 2026-04-30 8:01 ` Li Wang 1 sibling, 0 replies; 11+ messages in thread From: Li Wang @ 2026-04-30 8:01 UTC (permalink / raw) To: Wei Gao; +Cc: ltp Hi Wei, Petr, Wei Gao via ltp wrote: > Base description/implementation of test case, The original test is "passive," merely creating a > mapping and relying on external processes to trigger swapping(case has sleep_time parameter). > Further more, this case is "ghost test" for current kernel, it do mmap but never > writes to it, so kernel never actually allocated memory, > Together with current obsolete logic(test targets legcy mfile_swap) i suggest just delete > it instead of wasting time patching(refactor) it. What do you think? @Petr @wang li? After looking into the details of mmapstress06, I agree that this test only simulates progress and still requires another stress tester to create memory pressure and trigger swapping. Instead of removing this test, I prefer to refactor it into a new API and encapsulate the orignial method within Cgroups. e.g. 1. Check system swap availability 2. Create cgroup with memory.max and memory.swap.max limits 3. Create large anonymous shared mapping (original size) 4. Allocate stress region: size > memory.max in child 5. Ditry every page in stress region 6. Check process VmSwap increase 7. Cleanup -- Regards, Li Wang -- Mailing list info: https://lists.linux.it/listinfo/ltp ^ permalink raw reply [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