public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: David Rientjes <rientjes@google.com>
Cc: Nick Piggin <npiggin@suse.de>, Rik van Riel <riel@redhat.com>,
	Mel Gorman <mel@csn.ul.ie>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Christoph Lameter <cl@linux-foundation.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [patch 3/3 -mmotm] oom: invoke oom killer for __GFP_NOFAIL
Date: Mon, 1 Jun 2009 22:56:02 -0700	[thread overview]
Message-ID: <20090601225602.3482cd0d.akpm@linux-foundation.org> (raw)
In-Reply-To: <alpine.DEB.2.00.0906011830490.6936@chino.kir.corp.google.com>

On Mon, 1 Jun 2009 18:31:14 -0700 (PDT) David Rientjes <rientjes@google.com> 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: Nick Piggin <npiggin@suse.de>
> Cc: Rik van Riel <riel@redhat.com>
> Cc: Mel Gorman <mel@csn.ul.ie>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> 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 |   12 +++++++-----
>  1 files changed, 7 insertions(+), 5 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 */
> @@ -1765,11 +1765,13 @@ rebalance:
>  				goto got_pg;
>  
>  			/*
> -			 * 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
> +			 * The OOM killer does not trigger for high-order
> +			 * ~__GFP_NOFAIL allocations so if no progress is being
> +			 * made, there are no other options and retrying is
> +			 * unlikely to help.
>  			 */
> -			if (order > PAGE_ALLOC_COSTLY_ORDER)
> +			if (order > PAGE_ALLOC_COSTLY_ORDER &&
> +						!(gfp_mask & __GFP_NOFAIL))
>  				goto nopage;
>  
>  			goto restart;

I really think/hope/expect that this is unneeded.

Do we know of any callsites which do greater-than-order-0 allocations
with GFP_NOFAIL?  If so, we should fix them.

Then just ban order>0 && GFP_NOFAIL allocations.

  reply	other threads:[~2009-06-02  5:57 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-02  1:31 [patch 1/3 -mmotm] oom: move oom_adj value from task_struct to mm_struct David Rientjes
2009-06-02  1:31 ` [patch 2/3 -mmotm] oom: avoid unnecessary mm locking and scanning for OOM_DISABLE David Rientjes
2009-06-02  1:31 ` [patch 3/3 -mmotm] oom: invoke oom killer for __GFP_NOFAIL David Rientjes
2009-06-02  5:56   ` Andrew Morton [this message]
2009-06-02  6:27     ` Nick Piggin
2009-06-02  6:41       ` Pekka Enberg
2009-06-02  7:26     ` David Rientjes
2009-06-02  7:34       ` Peter Zijlstra
2009-06-02  7:58         ` Nick Piggin
2009-06-02  8:14           ` David Rientjes
2009-06-03 22:10             ` David Rientjes
2009-06-03 22:26               ` Andrew Morton
2009-06-03 22:54                 ` Divy Le Ray

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=20090601225602.3482cd0d.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=cl@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mel@csn.ul.ie \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.com \
    --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