From: Michal Hocko <mhocko@kernel.org>
To: <linux-mm@kvack.org>
Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
David Rientjes <rientjes@google.com>,
Oleg Nesterov <oleg@redhat.com>,
Vladimir Davydov <vdavydov@parallels.com>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Michal Hocko <mhocko@suse.com>
Subject: [PATCH 5/6] mm, oom: kill all tasks sharing the mm
Date: Thu, 26 May 2016 14:40:14 +0200 [thread overview]
Message-ID: <1464266415-15558-6-git-send-email-mhocko@kernel.org> (raw)
In-Reply-To: <1464266415-15558-1-git-send-email-mhocko@kernel.org>
From: Michal Hocko <mhocko@suse.com>
Currently oom_kill_process skips both the oom reaper and SIG_KILL if a
process sharing the same mm is unkillable via OOM_ADJUST_MIN. After "mm,
oom_adj: make sure processes sharing mm have same view of oom_score_adj"
all such processes are sharing the same value so we shouldn't see such a
task at all (oom_badness would rule them out).
Moreover after "mm, oom: skip over vforked tasks" we even cannot
encounter vfork task so we can allow both SIG_KILL and oom reaper. A
potential race is highly unlikely but possible. It would happen if
__set_oom_adj raced with select_bad_process and then it is OK to
consider the old value or with fork when it should be acceptable as
well.
Let's add a little note to the log so that people would tell us that
this really happens in the real life and it matters.
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
mm/oom_kill.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index d1cbaaa1a666..008c5b4732de 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -850,8 +850,7 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
continue;
if (same_thread_group(p, victim))
continue;
- if (unlikely(p->flags & PF_KTHREAD) || is_global_init(p) ||
- p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) {
+ if (unlikely(p->flags & PF_KTHREAD) || is_global_init(p)) {
/*
* We cannot use oom_reaper for the mm shared by this
* process because it wouldn't get killed and so the
@@ -860,6 +859,11 @@ void oom_kill_process(struct oom_control *oc, struct task_struct *p,
can_oom_reap = false;
continue;
}
+ if (p->signal->oom_score_adj == OOM_ADJUST_MIN)
+ pr_warn("%s pid=%d shares mm with oom disabled %s pid=%d. Seems like misconfiguration, killing anyway!"
+ " Report at linux-mm@kvack.org\n",
+ victim->comm, task_pid_nr(victim),
+ p->comm, task_pid_nr(p));
do_send_sig_info(SIGKILL, SEND_SIG_FORCED, p, true);
}
rcu_read_unlock();
--
2.8.1
next prev parent reply other threads:[~2016-05-26 12:40 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-26 12:40 [PATCH 0/5] Handle oom bypass more gracefully Michal Hocko
2016-05-26 12:40 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external tasks sharing mm Michal Hocko
2016-05-26 14:30 ` Tetsuo Handa
2016-05-26 14:59 ` Michal Hocko
2016-05-26 15:25 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are noexternal " Tetsuo Handa
2016-05-26 15:35 ` Michal Hocko
2016-05-26 16:14 ` [PATCH 1/6] mm, oom: do not loop over all tasks if there are no external " Tetsuo Handa
2016-05-27 6:45 ` Michal Hocko
2016-05-27 7:15 ` Michal Hocko
2016-05-27 8:03 ` Michal Hocko
2016-05-26 12:40 ` [PATCH 2/6] proc, oom_adj: extract oom_score_adj setting into a helper Michal Hocko
2016-05-26 12:40 ` [PATCH 3/6] mm, oom_adj: make sure processes sharing mm have same view of oom_score_adj Michal Hocko
2016-05-27 11:18 ` Michal Hocko
2016-05-27 16:18 ` Vladimir Davydov
2016-05-30 7:07 ` Michal Hocko
2016-05-30 8:47 ` Vladimir Davydov
2016-05-30 9:39 ` Michal Hocko
2016-05-30 10:26 ` Vladimir Davydov
2016-05-30 11:11 ` Michal Hocko
2016-05-30 12:19 ` Vladimir Davydov
2016-05-30 12:28 ` Michal Hocko
2016-05-26 12:40 ` [PATCH 4/6] mm, oom: skip over vforked tasks Michal Hocko
2016-05-27 16:48 ` Vladimir Davydov
2016-05-30 7:13 ` Michal Hocko
2016-05-30 9:52 ` Michal Hocko
2016-05-30 10:40 ` Vladimir Davydov
2016-05-30 10:53 ` Michal Hocko
2016-05-30 12:03 ` Michal Hocko
2016-05-26 12:40 ` Michal Hocko [this message]
2016-05-26 12:40 ` [PATCH 6/6] mm, oom: fortify task_will_free_mem Michal Hocko
2016-05-26 14:11 ` Tetsuo Handa
2016-05-26 14:23 ` Michal Hocko
2016-05-26 14:41 ` Tetsuo Handa
2016-05-26 14:56 ` Michal Hocko
2016-05-27 11:07 ` Michal Hocko
2016-05-27 16:00 ` [PATCH 0/5] Handle oom bypass more gracefully Michal Hocko
2016-05-30 13:05 [PATCH 0/6 -v2] " Michal Hocko
2016-05-30 13:05 ` [PATCH 5/6] mm, oom: kill all tasks sharing the mm Michal Hocko
2016-05-30 18:18 ` Oleg Nesterov
2016-05-31 7:43 ` Michal Hocko
2016-05-31 21:48 ` Oleg Nesterov
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=1464266415-15558-6-git-send-email-mhocko@kernel.org \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=oleg@redhat.com \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=rientjes@google.com \
--cc=vdavydov@parallels.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).