Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH] getrusage03: mlock the memory area in consume_mb
@ 2022-02-08 13:24 Li Wang
  2022-02-08 13:36 ` Li Wang
  2022-02-09  8:52 ` [LTP] [PATCH v2] getrusage03: mlock all address space for process calling consume_mb Li Wang
  0 siblings, 2 replies; 7+ messages in thread
From: Li Wang @ 2022-02-08 13:24 UTC (permalink / raw)
  To: ltp

Seems it trying to test without swap happen to guarantee less
disturbing for the ’->ru_maxrss‘ counting.

Therefore add mlock() to prevent that memory allocated by consume_mb
from being paged to the swap area.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/getrusage/getrusage03.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testcases/kernel/syscalls/getrusage/getrusage03.h b/testcases/kernel/syscalls/getrusage/getrusage03.h
index f1bbe9be5..d46fdff85 100644
--- a/testcases/kernel/syscalls/getrusage/getrusage03.h
+++ b/testcases/kernel/syscalls/getrusage/getrusage03.h
@@ -18,6 +18,7 @@ static void consume_mb(int consume_nr)
 
 	size = consume_nr * 1024 * 1024;
 	ptr = SAFE_MALLOC(size);
+	mlock(ptr, size);
 	memset(ptr, 0, size);
 
 	SAFE_FILE_LINES_SCANF("/proc/self/status", "VmSwap: %lu", &vmswap_size);
-- 
2.31.1


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

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

end of thread, other threads:[~2022-02-21  1:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 13:24 [LTP] [PATCH] getrusage03: mlock the memory area in consume_mb Li Wang
2022-02-08 13:36 ` Li Wang
2022-02-09  8:52 ` [LTP] [PATCH v2] getrusage03: mlock all address space for process calling consume_mb Li Wang
2022-02-16  9:54   ` Cyril Hrubis
2022-02-17  6:59     ` Li Wang
2022-02-17 15:19       ` Cyril Hrubis
2022-02-21  1:57         ` Li Wang

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