* [PATCH] mm,oom: don't kill children of oom_task_origin() process.
@ 2016-02-20 4:54 Tetsuo Handa
2016-02-22 11:39 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2016-02-20 4:54 UTC (permalink / raw)
To: mhocko, rientjes; +Cc: linux-mm, Tetsuo Handa
Selecting a child of the candidate which was chosen by oom_task_origin()
is pointless. We want to kill the candidate first.
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
mm/oom_kill.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 28d6a32..703537a2 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -697,6 +697,14 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
if (__ratelimit(&oom_rs))
dump_header(oc, p, memcg);
+ /*
+ * We must send SEGKILL on p rather than p's children in order to make
+ * sure that oom_task_origin(p) becomes false. Printing the score value
+ * which is (ULONG_MAX * 1000 / totalpages) is useless for this case.
+ */
+ if (oom_task_origin(p))
+ goto kill;
+
pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n",
message, task_pid_nr(p), p->comm, points);
@@ -728,6 +736,7 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
}
read_unlock(&tasklist_lock);
+ kill:
p = find_lock_task_mm(victim);
if (!p) {
put_task_struct(victim);
--
1.8.3.1
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm,oom: don't kill children of oom_task_origin() process.
2016-02-20 4:54 [PATCH] mm,oom: don't kill children of oom_task_origin() process Tetsuo Handa
@ 2016-02-22 11:39 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2016-02-22 11:39 UTC (permalink / raw)
To: Tetsuo Handa; +Cc: rientjes, linux-mm
On Sat 20-02-16 13:54:02, Tetsuo Handa wrote:
> Selecting a child of the candidate which was chosen by oom_task_origin()
> is pointless. We want to kill the candidate first.
NACK, until we see a clear evidence that there is a real application
which triggers ksm/swapoff from a context where this would make a
difference. There is no good reason to add new checks to an already
subtle code just for something that even doesn't matter in the real
life.
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> ---
> mm/oom_kill.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 28d6a32..703537a2 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -697,6 +697,14 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
> if (__ratelimit(&oom_rs))
> dump_header(oc, p, memcg);
>
> + /*
> + * We must send SEGKILL on p rather than p's children in order to make
> + * sure that oom_task_origin(p) becomes false. Printing the score value
> + * which is (ULONG_MAX * 1000 / totalpages) is useless for this case.
> + */
> + if (oom_task_origin(p))
> + goto kill;
> +
> pr_err("%s: Kill process %d (%s) score %u or sacrifice child\n",
> message, task_pid_nr(p), p->comm, points);
>
> @@ -728,6 +736,7 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
> }
> read_unlock(&tasklist_lock);
>
> + kill:
> p = find_lock_task_mm(victim);
> if (!p) {
> put_task_struct(victim);
> --
> 1.8.3.1
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
--
Michal Hocko
SUSE Labs
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-02-22 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-20 4:54 [PATCH] mm,oom: don't kill children of oom_task_origin() process Tetsuo Handa
2016-02-22 11:39 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox