From: Michal Hocko <mhocko@kernel.org>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Rik van Riel <riel@redhat.com>
Subject: Re: [PATCH] mm: Check for SIGKILL inside dup_mmap() loop.
Date: Tue, 3 Apr 2018 14:08:31 +0200 [thread overview]
Message-ID: <20180403120831.GT5501@dhcp22.suse.cz> (raw)
In-Reply-To: <20180403115857.GC5832@bombadil.infradead.org>
On Tue 03-04-18 04:58:57, Matthew Wilcox wrote:
> On Thu, Mar 29, 2018 at 02:30:03PM -0700, Andrew Morton wrote:
> > > @@ -440,6 +440,10 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
> > > continue;
> > > }
> > > charge = 0;
> > > + if (fatal_signal_pending(current)) {
> > > + retval = -EINTR;
> > > + goto out;
> > > + }
> > > if (mpnt->vm_flags & VM_ACCOUNT) {
> > > unsigned long len = vma_pages(mpnt);
> >
> > I think a comment explaining why we're doing this would help.
> >
> > Better would be to add a new function "current_is_oom_killed()" or
> > such, which becomes self-documenting. Because there are other reasons
> > why a task may have a fatal signal pending.
>
> I disagree that we need a comment here, or to create an alias. Someone
> who knows nothing of the oom-killer (like, er, me) reading that code sees
> "Oh, we're checking for fatal signals here. I guess it doesn't make sense
> to continue forking a process if it's already received a fatal signal."
>
> One might speculate about the causes of the fatal signal having been
> received and settle on reasons which make sense even without thinking
> of the OOM case. Because it's why it was introduced, I always think
> about a task blocked on a dead NFS mount. If it's multithreaded and
> one of the threads called fork() while another thread was blocked on a
> page fault and the dup_mmap() had to wait for the page fault to finish
> ... that would make some kind of sense.
I completely agree. If the check is really correct then it should be
pretty much self explanatory like many other checks. There is absolutely
zero oom specific in there. If a check _is_ oom specific then there is
something fishy going on.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2018-04-03 12:08 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-29 11:27 Tetsuo Handa
2018-03-29 21:30 ` Andrew Morton
2018-03-30 10:34 ` Tetsuo Handa
2018-04-03 12:14 ` Matthew Wilcox
2018-04-03 12:19 ` Michal Hocko
2018-04-03 12:25 ` Matthew Wilcox
2018-04-03 14:54 ` Tetsuo Handa
2018-04-03 12:29 ` Tetsuo Handa
2018-04-03 13:06 ` Michal Hocko
2018-04-03 11:16 ` Michal Hocko
2018-04-03 11:32 ` Tetsuo Handa
2018-04-03 11:38 ` Michal Hocko
2018-04-03 11:58 ` Matthew Wilcox
2018-04-03 12:08 ` Michal Hocko [this message]
2018-04-07 10:38 ` Tetsuo Handa
2018-04-18 21:44 ` Andrew Morton
2018-04-19 1:54 ` Tetsuo Handa
2018-04-19 2:32 ` Andrew Morton
2018-06-07 22:05 ` Andrew Morton
2018-06-08 17:05 ` Matthew Wilcox
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=20180403120831.GT5501@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penguin-kernel@I-love.SAKURA.ne.jp \
--cc=riel@redhat.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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