[LTP] [PATCH v2 3/3] oom: enable OOM protection for mem lib process

Li Wang liwang@redhat.com
Fri Dec 17 12:37:50 CET 2021


Just simply invoke oom protection on mem library to make
it can collect full state of children.

Signed-off-by: Li Wang <liwang@redhat.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/kernel/mem/lib/mem.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/testcases/kernel/mem/lib/mem.c b/testcases/kernel/mem/lib/mem.c
index ac890491c..566e29055 100644
--- a/testcases/kernel/mem/lib/mem.c
+++ b/testcases/kernel/mem/lib/mem.c
@@ -129,8 +129,11 @@ void oom(int testcase, int lite, int retcode, int allow_sigkill)
 	pid_t pid;
 	int status, threads;
 
+	tst_enable_oom_protection(getpid());
+
 	switch (pid = SAFE_FORK()) {
 	case 0:
+		tst_cancel_oom_protection(getpid());
 		threads = MAX(1, tst_ncpus() - 1);
 		child_alloc(testcase, lite, threads);
 	default:
-- 
2.31.1



More information about the ltp mailing list