From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437AbZEKKkm (ORCPT ); Mon, 11 May 2009 06:40:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752275AbZEKKkd (ORCPT ); Mon, 11 May 2009 06:40:33 -0400 Received: from gir.skynet.ie ([193.1.99.77]:60748 "EHLO gir.skynet.ie" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752207AbZEKKkc (ORCPT ); Mon, 11 May 2009 06:40:32 -0400 Date: Mon, 11 May 2009 11:40:29 +0100 From: Mel Gorman To: David Rientjes Cc: Andrew Morton , Peter Zijlstra , Nick Piggin , Christoph Lameter , Dave Hansen , linux-kernel@vger.kernel.org Subject: Re: [patch -mmotm] mm: invoke oom killer for __GFP_NOFAIL Message-ID: <20090511104029.GB19847@csn.ul.ie> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17+20080114 (2008-01-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Cc: Peter Zijlstra > Cc: Nick Piggin > Cc: Christoph Lameter > Cc: Dave Hansen > Signed-off-by: David Rientjes > --- > 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 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