All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mel Gorman <mel@csn.ul.ie>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nick Piggin <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: Fri, 17 Jul 2009 10:21:57 +0100	[thread overview]
Message-ID: <20090717092157.GA9835@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.2.00.0907161202500.27201@chino.kir.corp.google.com>

On Thu, Jul 16, 2009 at 12:14:13PM -0700, David Rientjes wrote:
> On Thu, 16 Jul 2009, Mel Gorman wrote:
> 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 4b8552e..b381a6b 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1830,8 +1830,6 @@ rebalance:
> >  			if (order > PAGE_ALLOC_COSTLY_ORDER &&
> >  						!(gfp_mask & __GFP_NOFAIL))
> >  				goto nopage;
> > -
> > -			goto restart;
> >  		}
> >  	}
> >  
> > 
> 
> This isn't right (and not only because it'll add a compiler warning 
> because `restart' is now unused).
> 
> This would immediately fail any allocation that triggered the oom killer 
> and ended up being selected that isn't __GFP_NOFAIL, even if it would have 
> succeeded without even killing any task simply because it allocates 
> without watermarks.
> 
> It will also, coupled with your earlier patch, inappropriately warn about 
> an infinite loop with __GFP_NOFAIL even though it hasn't even attempted to 
> loop once since that decision is now handled by should_alloc_retry().
> 
> The liklihood of such an infinite loop, considering only one thread per 
> system (or cpuset) can be TIF_MEMDIE at a time, is very low.  I've never 
> seen memory reserves completely depleted such that the next high-priority 
> allocation wouldn't succeed so that current could handle its pending 
> SIGKILL.
> 
> You get the same behavior with my patch, but are allowed to try the high 
> priority allocation again for the attempt that triggered the oom killer 
> (and not only subsequent ones).

Ok, lets go with this patch then. Thanks

> ---
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1789,6 +1789,10 @@ rebalance:
>  	if (p->flags & PF_MEMALLOC)
>  		goto nopage;
>  
> +	/* Avoid allocations with no watermarks from looping endlessly */
> +	if (test_thread_flag(TIF_MEMDIE) && !(gfp_mask & __GFP_NOFAIL))
> +		goto nopage;
> +
>  	/* Try direct reclaim and then allocating */
>  	page = __alloc_pages_direct_reclaim(gfp_mask, order,
>  					zonelist, high_zoneidx,
> 

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

WARNING: multiple messages have this Message-ID (diff)
From: Mel Gorman <mel@csn.ul.ie>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Nick Piggin <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: Fri, 17 Jul 2009 10:21:57 +0100	[thread overview]
Message-ID: <20090717092157.GA9835@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.2.00.0907161202500.27201@chino.kir.corp.google.com>

On Thu, Jul 16, 2009 at 12:14:13PM -0700, David Rientjes wrote:
> On Thu, 16 Jul 2009, Mel Gorman wrote:
> 
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 4b8552e..b381a6b 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -1830,8 +1830,6 @@ rebalance:
> >  			if (order > PAGE_ALLOC_COSTLY_ORDER &&
> >  						!(gfp_mask & __GFP_NOFAIL))
> >  				goto nopage;
> > -
> > -			goto restart;
> >  		}
> >  	}
> >  
> > 
> 
> This isn't right (and not only because it'll add a compiler warning 
> because `restart' is now unused).
> 
> This would immediately fail any allocation that triggered the oom killer 
> and ended up being selected that isn't __GFP_NOFAIL, even if it would have 
> succeeded without even killing any task simply because it allocates 
> without watermarks.
> 
> It will also, coupled with your earlier patch, inappropriately warn about 
> an infinite loop with __GFP_NOFAIL even though it hasn't even attempted to 
> loop once since that decision is now handled by should_alloc_retry().
> 
> The liklihood of such an infinite loop, considering only one thread per 
> system (or cpuset) can be TIF_MEMDIE at a time, is very low.  I've never 
> seen memory reserves completely depleted such that the next high-priority 
> allocation wouldn't succeed so that current could handle its pending 
> SIGKILL.
> 
> You get the same behavior with my patch, but are allowed to try the high 
> priority allocation again for the attempt that triggered the oom killer 
> (and not only subsequent ones).

Ok, lets go with this patch then. Thanks

> ---
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1789,6 +1789,10 @@ rebalance:
>  	if (p->flags & PF_MEMALLOC)
>  		goto nopage;
>  
> +	/* Avoid allocations with no watermarks from looping endlessly */
> +	if (test_thread_flag(TIF_MEMDIE) && !(gfp_mask & __GFP_NOFAIL))
> +		goto nopage;
> +
>  	/* Try direct reclaim and then allocating */
>  	page = __alloc_pages_direct_reclaim(gfp_mask, order,
>  					zonelist, high_zoneidx,
> 

-- 
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-17  9:22 UTC|newest]

Thread overview: 20+ 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 10:49 ` Mel Gorman
2009-07-15 20:29 ` David Rientjes
2009-07-15 20:29   ` David Rientjes
2009-07-15 20:59   ` David Rientjes
2009-07-15 20:59     ` David Rientjes
2009-07-16 11:03   ` Mel Gorman
2009-07-16 11:03     ` Mel Gorman
2009-07-16 19:14     ` David Rientjes
2009-07-16 19:14       ` David Rientjes
2009-07-17  9:21       ` Mel Gorman [this message]
2009-07-17  9:21         ` Mel Gorman
2009-07-17 10:29         ` David Rientjes
2009-07-17 10:29           ` David Rientjes
2009-07-17 12:41           ` Hugh Dickins
2009-07-17 12:41             ` Hugh Dickins
2009-07-15 20:30 ` Andrew Morton
2009-07-15 20:30   ` Andrew Morton
2009-07-16 11:05   ` Mel Gorman
2009-07-16 11:05     ` Mel Gorman

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=20090717092157.GA9835@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.