[LTP] [PATCH 1/2] move_pages12: Ignore ENOMEM from madvise(MADV_SOFT_OFFLINE)

Martin Doucha mdoucha@suse.cz
Wed Mar 19 18:24:20 CET 2025


The test dissolves hugepages which results in soft-offline madvise() call
returning ENOMEM after a few iterations. This is expected behavior. However,
trying to preallocate more hugepages to prevent the error will break
the ability to reproduce the SIGBUS bug. Simply ignoring the ENOMEM error
is good enough.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/syscalls/move_pages/move_pages12.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/move_pages/move_pages12.c b/testcases/kernel/syscalls/move_pages/move_pages12.c
index 879a89b6f..a5454b1ec 100644
--- a/testcases/kernel/syscalls/move_pages/move_pages12.c
+++ b/testcases/kernel/syscalls/move_pages/move_pages12.c
@@ -100,7 +100,7 @@ static void *addr;
 static int do_soft_offline(int tpgs)
 {
 	if (madvise(addr, tpgs * hpsz, MADV_SOFT_OFFLINE) == -1) {
-		if (errno != EINVAL && errno != EBUSY)
+		if (errno != EINVAL && errno != EBUSY && errno != ENOMEM)
 			tst_res(TFAIL | TERRNO, "madvise failed");
 		return errno;
 	}
-- 
2.47.0



More information about the ltp mailing list