linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: David Rientjes <rientjes@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [patch 3.5-rc3] mm, oom: fix potential killing of thread that is disabled from oom killing
Date: Fri, 22 Jun 2012 19:02:55 -0400	[thread overview]
Message-ID: <CAHGf_=qyj25z2fair3J+BSTeFQpFVSv9DGoXQUpZHxRZp-ySgA@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1206221443210.23486@chino.kir.corp.google.com>

On Fri, Jun 22, 2012 at 5:44 PM, David Rientjes <rientjes@google.com> wrote:
> /proc/sys/vm/oom_kill_allocating_task will immediately kill current when
> the oom killer is called to avoid a potentially expensive tasklist scan
> for large systems.
>
> Currently, however, it is not checking current's oom_score_adj value
> which may be OOM_SCORE_ADJ_MIN, meaning that it has been disabled from
> oom killing.
>
> This patch avoids killing current in such a condition and simply falls
> back to the tasklist scan since memory still needs to be freed.
>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  mm/oom_kill.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -720,9 +720,9 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask,
>        check_panic_on_oom(constraint, gfp_mask, order, mpol_mask);
>
>        read_lock(&tasklist_lock);
> -       if (sysctl_oom_kill_allocating_task &&
> +       if (sysctl_oom_kill_allocating_task && current->mm &&
>            !oom_unkillable_task(current, NULL, nodemask) &&
> -           current->mm) {
> +           current->signal->oom_score_adj != OOM_SCORE_ADJ_MIN) {
>                oom_kill_process(current, gfp_mask, order, 0, totalpages, NULL,
>                                 nodemask,
>                                 "Out of memory (oom_kill_allocating_task)");

Seems straight forward and reasonable.

Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

--
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>

      reply	other threads:[~2012-06-22 23:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-22 21:44 David Rientjes
2012-06-22 23:02 ` KOSAKI Motohiro [this message]

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='CAHGf_=qyj25z2fair3J+BSTeFQpFVSv9DGoXQUpZHxRZp-ySgA@mail.gmail.com' \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=akpm@linux-foundation.org \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.org \
    /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