public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] Taunt OOM killer in fork12 setup()
@ 2020-01-30 16:13 Martin Doucha
  2020-01-31  9:14 ` Li Wang
  0 siblings, 1 reply; 9+ messages in thread
From: Martin Doucha @ 2020-01-30 16:13 UTC (permalink / raw)
  To: ltp

On a system with low memory, fork12 can trigger OOM killer before it hits
any fork() limits. The OOM killer might accidentally kill e.g. the parent
shell and external testing tools will assume the test failed.

Set high oom_score_adj on the fork12 process so that the OOM killer focuses
on it and its children.

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

diff --git a/testcases/kernel/syscalls/fork/fork12.c b/testcases/kernel/syscalls/fork/fork12.c
index 75278b012..99b6900f4 100644
--- a/testcases/kernel/syscalls/fork/fork12.c
+++ b/testcases/kernel/syscalls/fork/fork12.c
@@ -108,6 +108,8 @@ int main(int ac, char **av)
 static void setup(void)
 {
 	tst_sig(FORK, fork12_sigs, cleanup);
+	/* Taunt the OOM killer so that it doesn't kill system processes */
+	SAFE_FILE_PRINTF(cleanup, "/proc/self/oom_score_adj", "500");
 	TEST_PAUSE;
 }
 
-- 
2.24.1


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

end of thread, other threads:[~2020-02-07 16:06 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-30 16:13 [LTP] [PATCH] Taunt OOM killer in fork12 setup() Martin Doucha
2020-01-31  9:14 ` Li Wang
2020-01-31  9:37   ` Jan Stancek
2020-01-31  9:47     ` Li Wang
2020-01-31 12:40     ` Martin Doucha
2020-01-31 14:20       ` Li Wang
2020-02-07 14:54     ` [LTP] [PATCH v2] " Martin Doucha
2020-02-07 14:56       ` Jan Stancek
2020-02-07 16:06       ` Cyril Hrubis

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