From: Sergey Dyasly <dserrg@gmail.com>
To: David Rientjes <rientjes@google.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.cz>,
Rusty Russell <rusty@rustcorp.com.au>,
Sha Zhengju <handai.szj@taobao.com>,
Oleg Nesterov <oleg@redhat.com>
Subject: Re: [PATCH] OOM killer: wait for tasks with pending SIGKILL to exit
Date: Tue, 1 Oct 2013 19:26:40 +0400 [thread overview]
Message-ID: <20131001192640.ed55682d3113b00b402bbef5@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1309301457590.28109@chino.kir.corp.google.com>
It seems to me that we are going nowhere with this discussion...
If you are ok with the first change in my patch regarding fatal_signal_pending,
I can send new patch with just that change.
On Mon, 30 Sep 2013 15:08:25 -0700 (PDT)
David Rientjes <rientjes@google.com> wrote:
> On Fri, 27 Sep 2013, Sergey Dyasly wrote:
>
> > What you are saying contradicts current OOMk code the way I read it. Comment in
> > oom_kill_process() says:
> >
> > "If the task is already exiting ... set TIF_MEMDIE so it can die quickly"
> >
> > I just want to know the right solution.
> >
>
> That's a comment, not code. The point of the PF_EXITING special handling
> in oom_kill_process() is to avoid telling sysadmins that a process has
> been killed to free memory when it has already called exit() and to avoid
> sacrificing one of its children for the exiting process.
>
> It may or may not need access to memory reserves to actually exit after
> PF_EXITING depending on whether it needs to allocate memory for
> coredumping or anything else. So instead of waiting for it to recall the
> oom killer, TIF_MEMDIE is set anyway. The point is that PF_EXITING
> processes can already get TIF_MEMDIE immediately when their memory
> allocation fails so there's no reason not to set it now as an
> optimization.
>
> But we definitely want to avoid printing anything to the kernel log when
> the process has already called exit() and issuing the SIGKILL at that
> point would be pointless.
>
> > You are mistaken, oom_kill_process() is only called from out_of_memory()
> > and mem_cgroup_out_of_memory().
> >
>
> out_of_memory() calls oom_kill_process() in two places, plus the call from
> mem_cgroup_out_of_memory(), making three calls in the tree. Not that this
> matters in the slightest, though.
>
> > > Read the comment about why we don't emit anything to the kernel log in
> > > this case; the process is already exiting, there's no need to kill it or
> > > make anyone believe that it was killed.
> >
> > Yes, but there is already the PF_EXITING check in oom_scan_process_thread(),
> > and in this case oom_kill_process() won't be even called. That's why it's
> > redundant.
> >
>
> You apparently have no idea how long select_bad_process() runs on a large
> system with thousands of processes. Keep in mind that SGI requested the
> addition of the oom_kill_allocating_task sysctl specifically because of
> how long select_bad_process() runs. The PF_EXITING check in
> oom_kill_process() is simply an optimization to return early and with
> access to memory reserves so it can exit as quickly as possible and
> without the kernel stating it's killing something that has already called
> exit().
--
Sergey Dyasly <dserrg@gmail.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>
next prev parent reply other threads:[~2013-10-01 15:27 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-09 15:30 [PATCH] OOM killer: wait for tasks with pending SIGKILL to exit Sergey Dyasly
2013-09-09 16:31 ` Oleg Nesterov
2013-09-09 20:11 ` David Rientjes
2013-09-09 20:07 ` David Rientjes
2013-09-11 15:06 ` Sergey Dyasly
2013-09-19 15:51 ` Sergey Dyasly
2013-09-25 20:31 ` David Rientjes
2013-09-27 14:58 ` Sergey Dyasly
2013-09-30 22:08 ` David Rientjes
2013-10-01 15:26 ` Sergey Dyasly [this message]
2013-10-01 22:46 ` David Rientjes
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=20131001192640.ed55682d3113b00b402bbef5@gmail.com \
--to=dserrg@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=handai.szj@taobao.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.cz \
--cc=oleg@redhat.com \
--cc=rientjes@google.com \
--cc=rusty@rustcorp.com.au \
/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).