linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: mhocko@kernel.org, akpm@linux-foundation.org,
	rientjes@google.com, kwalker@redhat.com, skozina@redhat.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -mm v2 1/3] mm/oom_kill: remove the wrong fatal_signal_pending() check in oom_kill_process()
Date: Fri, 2 Oct 2015 15:52:01 +0200	[thread overview]
Message-ID: <20151002135201.GA28533@redhat.com> (raw)
In-Reply-To: <201510022032.IFC65105.JFtMOQOVSHFLOF@I-love.SAKURA.ne.jp>

Tetsuo, sorry, I don't understand your question...

On 10/02, Tetsuo Handa wrote:
>
> Oleg Nesterov wrote:
> > On 10/01, Michal Hocko wrote:
> > >
> > > zap_process will add SIGKILL to all threads but the
> > > current which will go on without being killed and if this is not a
> > > thread group leader then we would miss it.
> >
> > Yes. And note that de_thread() does the same. Speaking of oom-killer
> > this is mostly fine, the execing thread is going to release its old
> > ->mm and it has already passed the copy_strings() stage which can use
> > a lot more memory.
>
> So, we have the same wrong fatal_signal_pending() check in out_of_memory()

Yes, sure, it is not right too. Again, this is even documented in
d003f371b27016354c:

    fatal_signal_pending() can be true because of SIGNAL_GROUP_COREDUMP so
    out_of_memory() and mem_cgroup_out_of_memory() shouldn't blindly trust it.

This is off-topic in a sense that this series only tries to ensure that
if we are going to kill a memory hog we can't miss a process which shares
the same mm (ignoring the OOM_SCORE_ADJ_MIN condition below).

>         /*
>          * If current has a pending SIGKILL or is exiting, then automatically
>          * select it.  The goal is to allow it to allocate so that it may
>          * quickly exit and free its memory.
>          *
>          * But don't select if current has already released its mm and cleared
>          * TIF_MEMDIE flag at exit_mm(), otherwise an OOM livelock may occur.
>          */
>         if (current->mm &&
>             (fatal_signal_pending(current) || task_will_free_mem(current))) {
>                 mark_oom_victim(current);
>                 return true;
>         }
>
> because it is possible that T starts the coredump, T sends SIGKILL to P,
> P calls out_of_memory() on GFP_FS allocation,

yes, and since fatal_signal_pending() == T we do not even check
task_will_free_mem().

> P misses to set SIGKILL on T?
>
> Since T sends SIGKILL to all clone(CLONE_VM) tasks upon coredump, P needs
> to do
>
> [...snip...]

> after mark_oom_victim(current) in case T is not in the same thread group?

I do not see how this depends on "not in the same thread group". This
fatal_signal_pending() doesn't look right in any case.


> If yes, what happens if some task failed to receive SIGKILL due to
> p->signal->oom_score_adj == OOM_SCORE_ADJ_MIN condition?

Oh. This is another issue. I already tried to suggest to remove this
check. But this needs more discussion, hopefully we can do this later.

Oleg.


  parent reply	other threads:[~2015-10-02 13:55 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-29 14:17 [PATCH -mm 0/3] mm/oom_kill: ensure we actually kill all tasks sharing the same mm Oleg Nesterov
2015-09-29 14:18 ` [PATCH -mm 1/3] mm/oom_kill: remove the wrong fatal_signal_pending() Oleg Nesterov
2015-09-29 22:36   ` David Rientjes
2015-09-30  1:42     ` Tetsuo Handa
2015-09-30 13:47       ` Oleg Nesterov
2015-09-30 15:20         ` [PATCH -mm 1/3] mm/oom_kill: remove the wrongfatal_signal_pending() Tetsuo Handa
2015-09-30 13:43     ` [PATCH -mm 1/3] mm/oom_kill: remove the wrong fatal_signal_pending() Oleg Nesterov
2015-09-29 14:18 ` [PATCH -mm 2/3] mm/oom_kill: cleanup the "kill sharing same memory" Oleg Nesterov
2015-09-29 22:39   ` David Rientjes
2015-09-30 13:49     ` Oleg Nesterov
2015-09-29 14:18 ` [PATCH -mm 3/3] mm/oom_kill: fix the wrong task->mm == mm checks in Oleg Nesterov
2015-09-29 22:41   ` David Rientjes
2015-09-30 13:50     ` Oleg Nesterov
2015-09-30  2:16   ` Tetsuo Handa
2015-09-30 13:59     ` Oleg Nesterov
2015-09-30 18:23 ` [PATCH -mm v2 0/3] mm/oom_kill: ensure we actually kill all tasks sharing the same mm Oleg Nesterov
2015-09-30 18:24   ` [PATCH -mm v2 1/3] mm/oom_kill: remove the wrong fatal_signal_pending() check in oom_kill_process() Oleg Nesterov
2015-09-30 21:14     ` David Rientjes
2015-10-01 10:52       ` [PATCH -mm v2 1/3] mm/oom_kill: remove the wrong fatal_signal_pending()check " Tetsuo Handa
2015-10-01 12:49     ` [PATCH -mm v2 1/3] mm/oom_kill: remove the wrong fatal_signal_pending() check " Michal Hocko
2015-10-01 15:00       ` Oleg Nesterov
2015-10-01 15:27         ` Michal Hocko
2015-10-01 15:41           ` Oleg Nesterov
2015-10-01 16:19             ` Michal Hocko
2015-10-01 17:53               ` Oleg Nesterov
2015-10-02 11:32                 ` Tetsuo Handa
2015-10-02 12:11                   ` Michal Hocko
2015-10-02 12:33                     ` Tetsuo Handa
2015-10-02 13:32                       ` Michal Hocko
2015-10-02 13:57                         ` Oleg Nesterov
2015-10-02 14:24                           ` Michal Hocko
2015-10-02 14:07                         ` Tetsuo Handa
2015-10-02 14:15                           ` Oleg Nesterov
2015-10-02 13:52                   ` Oleg Nesterov [this message]
2015-10-02 14:36                     ` Tetsuo Handa
2015-09-30 18:24   ` [PATCH -mm v2 2/3] mm/oom_kill: cleanup the "kill sharing same memory" loop Oleg Nesterov
2015-09-30 21:15     ` David Rientjes
2015-10-01 12:50     ` Michal Hocko
2015-09-30 18:24   ` [PATCH -mm v2 3/3] mm/oom_kill: fix the wrong task->mm == mm checks in oom_kill_process() Oleg Nesterov
2015-09-30 21:15     ` David Rientjes
2015-10-01 12:56     ` Michal Hocko
2015-10-01 22:24     ` Andrew Morton

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=20151002135201.GA28533@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=kwalker@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=rientjes@google.com \
    --cc=skozina@redhat.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).