linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: rientjes@google.com, npiggin@suse.de,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] page-allocator: Ensure that processes that have been OOM killed exit the page allocator (resend)
Date: Thu, 16 Jul 2009 12:05:57 +0100	[thread overview]
Message-ID: <20090716110557.GC22499@csn.ul.ie> (raw)
In-Reply-To: <20090715133014.a3566bdd.akpm@linux-foundation.org>

On Wed, Jul 15, 2009 at 01:30:14PM -0700, Andrew Morton wrote:
> On Wed, 15 Jul 2009 11:49:45 +0100
> Mel Gorman <mel@csn.ul.ie> wrote:
> 
> > Processes that have been OOM killed set the thread flag TIF_MEMDIE. A process
> > such as this is expected to exit the page allocator but potentially, it
> > loops forever. This patch checks TIF_MEMDIE when deciding whether to loop
> > again in the page allocator. If set, and __GFP_NOFAIL is not specified
> > then the loop will exit on the assumption it's no longer important for the
> > process to make forward progress. Note that a process that has just been
> > OOM-killed will still loop at least one more time retrying the allocation
> > before the thread flag is checked.
> > 
> > Signed-off-by: Mel Gorman <mel@csn.ul.ie>
> > --- 
> >  mm/page_alloc.c |    8 ++++++++
> >  1 file changed, 8 insertions(+)
> > 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index f8902e7..5c98d02 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1547,6 +1547,14 @@ should_alloc_retry(gfp_t gfp_mask, unsigned int order,
> >  	if (gfp_mask & __GFP_NORETRY)
> >  		return 0;
> >  
> > +	/* Do not loop if OOM-killed unless __GFP_NOFAIL is specified */
> > +	if (test_thread_flag(TIF_MEMDIE)) {
> > +		if (gfp_mask & __GFP_NOFAIL)
> > +			WARN(1, "Potential infinite loop with __GFP_NOFAIL");
> > +		else
> > +			return 0;
> > +	}
> > +
> >  	/*
> >  	 * In this implementation, order <= PAGE_ALLOC_COSTLY_ORDER
> >  	 * means __GFP_NOFAIL, but that may not be true in other
> 
> This fixes a post-2.6.30 regression, yes?
> 
> I dug out the commit ID a while back but lost it. Ho hum.
> 

You made a note at the time "Offending commit 341ce06 handled the PF_MEMALLOC
case but forgot about the TIF_MEMDIE case."

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
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:[~2009-07-16 11:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15 10:49 [PATCH] page-allocator: Ensure that processes that have been OOM killed exit the page allocator (resend) Mel Gorman
2009-07-15 20:29 ` David Rientjes
2009-07-15 20:59   ` David Rientjes
2009-07-16 11:03   ` Mel Gorman
2009-07-16 19:14     ` David Rientjes
2009-07-17  9:21       ` Mel Gorman
2009-07-17 10:29         ` David Rientjes
2009-07-17 12:41           ` Hugh Dickins
2009-07-15 20:30 ` Andrew Morton
2009-07-16 11:05   ` Mel Gorman [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=20090716110557.GC22499@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=rientjes@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).