From: Andrew Morton <akpm@linux-foundation.org>
To: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>,
Luigi Semenzato <semenzato@google.com>,
linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
Dan Magenheimer <dan.magenheimer@oracle.com>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
Sonny Rao <sonnyrao@google.com>, Minchan Kim <minchan@kernel.org>
Subject: Re: [PATCH] mm: vmscan: Check for fatal signals iff the process was throttled
Date: Wed, 21 Nov 2012 13:30:17 -0800 [thread overview]
Message-ID: <20121121133017.f98149f2.akpm@linux-foundation.org> (raw)
In-Reply-To: <20121121210520.GP8218@suse.de>
On Wed, 21 Nov 2012 21:05:20 +0000
Mel Gorman <mgorman@suse.de> wrote:
> On Wed, Nov 21, 2012 at 12:15:59PM -0800, Andrew Morton wrote:
>
> ...
>
> > > -static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
> > > +static bool throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
> > > nodemask_t *nodemask)
> > > {
> > > struct zone *zone;
> > > @@ -2224,13 +2227,20 @@ static void throttle_direct_reclaim(gfp_t gfp_mask, struct zonelist *zonelist,
> > > * processes to block on log_wait_commit().
> > > */
> > > if (current->flags & PF_KTHREAD)
> > > - return;
> > > + goto out;
> >
> > hm, well, back in the old days some kernel threads were killable via
> > signals. They had to opt-in to it by diddling their signal masks and a
> > few other things. Too lazy to check if there are still any such sites.
> >
>
> That check is against throttling rather than signal handling though. It
> could have been just left as "return".
My point is that there might still exist kernel threads which are killable
via signals. Those threads match your criteria here: don't throttle -
just let them run to exit().
If there are indeed missed opportunities here then they will be small
ones. And those threads probably only have signal_pending(), not
fatal_signal_pending(). Don't worry about it ;)
> >
> > > + /*
> > > + * If a fatal signal is pending, this process should not throttle.
> > > + * It should return quickly so it can exit and free its memory
> > > + */
> > > + if (fatal_signal_pending(current))
> > > + goto out;
> >
> > theresabug. It should return "true" here.
> >
>
> The intention here is that a process would
>
> 1. allocate, fail, enter direct reclaim
> 2. no signal pending, gets throttled because of low pfmemalloc reserves
> 3. a user kills -9 the throttled process. returns true and goes back
> to the page allocator
> 4. If that allocation fails again, it re-enters direct reclaim and tries
> to throttle. This time the fatal signal is pending but we know
> we must have already failed to make the allocation so this time false
> is rurned by throttle_direct_reclaim and it tries direct reclaim.
My spinning head fell on the floor and is now drilling its way to China.
> 5. direct reclaim frees something -- probably clean file-backed pages
> if the last allocation attempt had failed.
>
> so the fatal signal check should only prevent entering direct reclaim
> once. Maybe the comment sucks
Well it did say "Returns true if a fatal signal was received during
throttling.". That "during" was subtle.
> /*
> * If a fatal signal is pending, this process should not throttle.
> * It should return quickly so it can exit and free its memory. Note
> * that returning false here allows a process to enter direct reclaim.
> * Otherwise there is a risk that the process loops in the page
> * allocator, checking signals and never making forward progress
> */
>
> ?
It's still unclear why throttle_direct_reclaim() returns false if
fatal_signal_pending() *before* throttling, but true *after* throttling.
Why not always return true and just scram?
>
> ...
>
> Same comment about the potential looping. Otherwise I think it's ok.
Send me something sometime ;)
--
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:[~2012-11-21 21:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-02 6:39 zram OOM behavior Minchan Kim
2012-11-02 8:30 ` Mel Gorman
2012-11-02 22:36 ` Minchan Kim
2012-11-05 14:46 ` Mel Gorman
2012-11-06 0:25 ` Minchan Kim
2012-11-06 8:58 ` Mel Gorman
2012-11-06 10:17 ` Minchan Kim
2012-11-09 9:50 ` Mel Gorman
2012-11-12 13:32 ` Minchan Kim
2012-11-12 14:06 ` Mel Gorman
2012-11-13 13:31 ` Minchan Kim
2012-11-21 15:38 ` [PATCH] mm: vmscan: Check for fatal signals iff the process was throttled Mel Gorman
2012-11-21 20:15 ` Andrew Morton
2012-11-21 21:05 ` Mel Gorman
2012-11-21 21:30 ` Andrew Morton [this message]
2012-11-23 5:09 ` Minchan Kim
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=20121121133017.f98149f2.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=dan.magenheimer@oracle.com \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=rientjes@google.com \
--cc=semenzato@google.com \
--cc=sonnyrao@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;
as well as URLs for NNTP newsgroup(s).