From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v3 2/3] lib: enable OOM protection for ltp lib process
Date: Mon, 20 Dec 2021 17:54:15 +0800 [thread overview]
Message-ID: <20211220095416.583323-2-liwang@redhat.com> (raw)
In-Reply-To: <20211220095416.583323-1-liwang@redhat.com>
We do protect ltp-lib ($PID) process from killing by OOM Killer,
hope this can help to get the completed correct report for all of
LTP tests.
This achieve by invoking tst_enable_oom_protection in tst_run_tcases,
at the same time, we purposely disabling the protection for children
in fork_testrun, to avoid the oom score inherit by testcase.
Fundamental principle:
ltp test harness --> library process
(enable protection) main --> tst_run_tcases --> ... --> fork_testrun
(disable protection) testrun --> run_tests --> ... --> testname
child_test --> ... --> end
Signed-off-by: Li Wang <liwang@redhat.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
lib/tst_test.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index ce2b8239d..51f438d06 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -1446,6 +1446,7 @@ static int fork_testrun(void)
tst_brk(TBROK | TERRNO, "fork()");
if (!test_pid) {
+ tst_disable_oom_protection(0);
SAFE_SIGNAL(SIGALRM, SIG_DFL);
SAFE_SIGNAL(SIGUSR1, SIG_DFL);
SAFE_SIGNAL(SIGINT, SIG_DFL);
@@ -1523,6 +1524,7 @@ void tst_run_tcases(int argc, char *argv[], struct tst_test *self)
tst_test = self;
do_setup(argc, argv);
+ tst_enable_oom_protection(lib_pid);
SAFE_SIGNAL(SIGALRM, alarm_handler);
SAFE_SIGNAL(SIGUSR1, heartbeat_handler);
--
2.31.1
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2021-12-20 9:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-20 9:54 [LTP] [PATCH v3 1/3] lib: add functions to adjust oom score Li Wang
2021-12-20 9:54 ` Li Wang [this message]
2021-12-20 13:26 ` [LTP] [PATCH v3 2/3] lib: enable OOM protection for ltp lib process Cyril Hrubis
2021-12-20 9:54 ` [LTP] [PATCH v3 3/3] oom: enable OOM protection for mem " Li Wang
2021-12-20 13:27 ` Cyril Hrubis
2021-12-20 13:26 ` [LTP] [PATCH v3 1/3] lib: add functions to adjust oom score Cyril Hrubis
2021-12-20 18:13 ` Petr Vorel
2021-12-20 18:34 ` Petr Vorel
2021-12-21 2:50 ` Li Wang
2021-12-21 8:33 ` Petr Vorel
2021-12-21 9:18 ` Cyril Hrubis
2021-12-21 9:23 ` Li Wang
2021-12-21 9:40 ` Li Wang
2021-12-21 9:59 ` Cyril Hrubis
2021-12-21 10:12 ` Li Wang
2021-12-21 10:36 ` Cyril Hrubis
2021-12-21 10:44 ` Petr Vorel
2021-12-21 11:32 ` Li Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211220095416.583323-2-liwang@redhat.com \
--to=liwang@redhat.com \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.