From 50a128fea76825684feb0762e57e47bb1074921d Mon Sep 17 00:00:00 2001 From: Brad Peters Date: Mon, 23 Jul 2012 16:36:19 -0700 Subject: [PATCH] Updating oom_score setting function to use new systemd interface. Changes child OOM score from unlikely to be killed (-16) to likely to be killed (+900). This helps us avoid a priority inversion --- launchpad_src/launchpad.c | 9 ++++++--- packaging/aul.changes | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/launchpad_src/launchpad.c b/launchpad_src/launchpad.c index c614d76..f89a4ed 100755 --- a/launchpad_src/launchpad.c +++ b/launchpad_src/launchpad.c @@ -114,12 +114,15 @@ _static_ void __set_oom() FILE *fp; /* we should reset oomadj value as default because child - inherits from parent oom_adj*/ - snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_adj", getpid()); + inherits from parent oom_score_adj*/ + snprintf(buf, MAX_LOCAL_BUFSZ, "/proc/%d/oom_score_adj", getpid()); fp = fopen(buf, "w"); if (fp == NULL) return; - fprintf(fp, "%d", -16); + /* Logically, the children processes being launched should be MORE + likely to be killed than the launcher and the rest of the OS. So + we need to set a high OOM score here */ + fprintf(fp, "%d", 900); fclose(fp); } diff --git a/packaging/aul.changes b/packaging/aul.changes index 9a79839..c7ebb5d 100644 --- a/packaging/aul.changes +++ b/packaging/aul.changes @@ -1,3 +1,9 @@ +* Mon Jul 23 2012 Brad Peters 7730828 +- Updating oom_score setting function to use new systemd interface. + Changing child oom_scores from very low (unlikely to be killed) to + very high (likely to be killed). This helps us avoid a priority + inversion, where OS services are killed off before applications. + * Mon Jul 3 2012 Brad Peters 7730828 - Adding a build tag -- 2.7.4