From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: David Rientjes <rientjes@google.com>
Cc: kosaki.motohiro@jp.fujitsu.com,
Andrew Morton <akpm@linux-foundation.org>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Rik van Riel <riel@redhat.com>,
linux-mm@kvack.org
Subject: Re: [patch 2/3 v3] oom: avoid killing a task if a thread sharing its mm cannot be killed
Date: Sun, 22 Aug 2010 18:49:04 +0900 (JST) [thread overview]
Message-ID: <20100822184526.600F.A69D9226@jp.fujitsu.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1008201541000.9201@chino.kir.corp.google.com>
>
> The oom killer's goal is to kill a memory-hogging task so that it may
> exit, free its memory, and allow the current context to allocate the
> memory that triggered it in the first place. Thus, killing a task is
> pointless if other threads sharing its mm cannot be killed because of its
> /proc/pid/oom_adj or /proc/pid/oom_score_adj value.
>
> This patch checks whether any other thread sharing p->mm has an
> oom_score_adj of OOM_SCORE_ADJ_MIN. If so, the thread cannot be killed
> and oom_badness(p) returns 0, meaning it's unkillable.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
> mm/oom_kill.c | 9 +++++----
> 1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -162,10 +162,11 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem,
> return 0;
>
> /*
> - * Shortcut check for OOM_SCORE_ADJ_MIN so the entire heuristic doesn't
> - * need to be executed for something that cannot be killed.
> + * Shortcut check for a thread sharing p->mm that is OOM_SCORE_ADJ_MIN
> + * so the entire heuristic doesn't need to be executed for something
> + * that cannot be killed.
> */
> - if (p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) {
> + if (atomic_read(&p->mm->oom_disable_count)) {
> task_unlock(p);
> return 0;
> }
> @@ -675,7 +676,7 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
> read_lock(&tasklist_lock);
> if (sysctl_oom_kill_allocating_task &&
> !oom_unkillable_task(current, NULL, nodemask) &&
> - (current->signal->oom_adj != OOM_DISABLE)) {
> + current->mm && !atomic_read(¤t->mm->oom_disable_count)) {
> /*
> * oom_kill_process() needs tasklist_lock held. If it returns
> * non-zero, current could not be killed so we must fallback to
This seems significantly cleaner than previous. Of cource, even though I need
to review [1/3] carefully. Unfortunatelly I'm very busy in this week, then
my responce might late a while. but it's not mean silinetly nak.
Thanks.
--
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>
next prev parent reply other threads:[~2010-08-22 9:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 22:41 [patch 1/3 v3] oom: add per-mm oom disable count David Rientjes
2010-08-20 22:41 ` [patch 2/3 v3] oom: avoid killing a task if a thread sharing its mm cannot be killed David Rientjes
2010-08-22 9:49 ` KOSAKI Motohiro [this message]
2010-08-22 23:14 ` David Rientjes
2010-08-20 22:41 ` [patch 3/3 v3] oom: kill all threads sharing oom killed task's mm David Rientjes
2010-08-20 23:52 ` David Rientjes
2010-08-23 23:16 ` Andrew Morton
2010-08-24 0:57 ` David Rientjes
2010-08-23 23:13 ` [patch 1/3 v3] oom: add per-mm oom disable count Andrew Morton
2010-08-24 0:53 ` David Rientjes
2010-08-27 21:48 ` Andrew Morton
2010-08-28 22:25 ` [patch] oom: fix locking for oom_adj and oom_score_adj David Rientjes
2010-08-30 4:39 ` [patch 1/3 v3] oom: add per-mm oom disable count KOSAKI Motohiro
2010-08-30 21:14 ` David Rientjes
2010-08-31 23:54 ` KOSAKI Motohiro
2010-09-01 23:41 ` David Rientjes
2010-09-02 0:50 ` KOSAKI Motohiro
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=20100822184526.600F.A69D9226@jp.fujitsu.com \
--to=kosaki.motohiro@jp.fujitsu.com \
--cc=akpm@linux-foundation.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
--cc=rientjes@google.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