From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759328AbZFBF5o (ORCPT ); Tue, 2 Jun 2009 01:57:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755361AbZFBF5g (ORCPT ); Tue, 2 Jun 2009 01:57:36 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:39625 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755317AbZFBF5g (ORCPT ); Tue, 2 Jun 2009 01:57:36 -0400 Date: Mon, 1 Jun 2009 22:56:02 -0700 From: Andrew Morton To: David Rientjes Cc: Nick Piggin , Rik van Riel , Mel Gorman , Peter Zijlstra , Christoph Lameter , Dave Hansen , linux-kernel@vger.kernel.org Subject: Re: [patch 3/3 -mmotm] oom: invoke oom killer for __GFP_NOFAIL Message-Id: <20090601225602.3482cd0d.akpm@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 2.4.8 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Jun 2009 18:31:14 -0700 (PDT) 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: Nick Piggin > Cc: Rik van Riel > Cc: Mel Gorman > Cc: Peter Zijlstra > Cc: Christoph Lameter > Cc: Dave Hansen > Signed-off-by: David Rientjes > --- > 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.