mirror of https://lore.kernel.org/lkml/
 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>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Nick Piggin <npiggin@suse.de>,
	Christoph Lameter <cl@linux-foundation.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch -mmotm] mm: invoke oom killer for __GFP_NOFAIL
Date: Mon, 11 May 2009 11:40:29 +0100	[thread overview]
Message-ID: <20090511104029.GB19847@csn.ul.ie> (raw)
In-Reply-To: <alpine.DEB.2.00.0905091544470.6884@chino.kir.corp.google.com>

On Sat, May 09, 2009 at 03:46:39PM -0700, David Rientjes wrote:
> The oom killer must be invoked regardless of the order if the allocation
> is __GFP_NOFAIL, otherwise it will loop forever when reclaim fails to
> free some memory.
> 
> Cc: Mel Gorman <mel@csn.ul.ie>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Nick Piggin <npiggin@suse.de>
> Cc: Christoph Lameter <cl@linux-foundation.org>
> Cc: Dave Hansen <dave@linux.vnet.ibm.com>
> Signed-off-by: David Rientjes <rientjes@google.com>
> ---
>  mm/page_alloc.c |   16 ++++++----------
>  1 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1547,7 +1547,7 @@ __alloc_pages_may_oom(gfp_t gfp_mask, unsigned int order,
>  		goto out;
>  
>  	/* The OOM killer will not help higher order allocs */
> -	if (order > PAGE_ALLOC_COSTLY_ORDER)
> +	if (order > PAGE_ALLOC_COSTLY_ORDER && !(gfp_mask & __GFP_NOFAIL))
>  		goto out;
>  
>  	/* Exhausted what can be done so it's blamo time */
> @@ -1763,16 +1763,12 @@ rebalance:
>  					migratetype);
>  			if (page)
>  				goto got_pg;
> +			if ((gfp_mask & __GFP_NOFAIL) ||
> +					order <= PAGE_ALLOC_COSTLY_ORDER)
> +				goto restart;
>  

Can this get a comment explaining the intention like the code you are
removing had? Something like this?

/*
 * The OOM killer only triggers for lower order allocation
 * requests and when __GFP_NOFAIL is specified to prevent
 * endlessly looping. Only retry the allocation if the OOM
 * killer was used.
 */

Otherwise, it looks ok.

Acked-by: Mel Gorman <mel@csn.ul.ie>

One related question, what is doing a costly-high-order allocation request
with __GFP_NOFAIL specified?

> -			/*
> -			 * The OOM killer does not trigger for high-order allocations
> -			 * but if no progress is being made, there are no other
> -			 * options and retrying is unlikely to help
> -			 */
> -			if (order > PAGE_ALLOC_COSTLY_ORDER)
> -				goto nopage;
> -
> -			goto restart;
> +			/* No freeing is possible so just fail */
> +			goto nopage;


>  		}
>  	}
>  
> 

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

  parent reply	other threads:[~2009-05-11 10:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-09 22:46 David Rientjes
2009-05-10 23:42 ` Rik van Riel
2009-05-11  7:29 ` Minchan Kim
2009-05-11  8:40   ` David Rientjes
2009-05-11  9:12     ` Minchan Kim
2009-05-11 11:21       ` Minchan Kim
2009-05-11 13:38         ` Mel Gorman
2009-05-11 14:00           ` Minchan Kim
2009-05-11 19:32             ` David Rientjes
2009-05-11 23:48               ` Minchan Kim
2009-05-11 21:32             ` Mel Gorman
2009-05-11 23:41               ` Minchan Kim
2009-05-11 10:40 ` Mel Gorman [this message]
2009-05-11 19:37   ` David Rientjes
2009-05-11 20:40 ` Andrew Morton
2009-05-12 12:42   ` Jens Axboe
2009-05-12 13:05     ` Nick Piggin
2009-05-12 16:37       ` Jens Axboe
2009-05-12 16:49         ` Nick Piggin
2009-05-12 17:35           ` Jens Axboe

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=20090511104029.GB19847@csn.ul.ie \
    --to=mel@csn.ul.ie \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®