Re: 5.7.0 page allocation failure: order:0, mode:0x400d0

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 08, 2020 at 02:33:08PM -0700, Hugh Dickins wrote:
> On Mon, 8 Jun 2020, Matthew Wilcox wrote:
> > On Mon, Jun 08, 2020 at 11:08:33AM +0200, Vlastimil Babka wrote:
> > >          * Fail silently without starting the shrinker
> > >         noreclaim = mapping_gfp_constraint(mapping, ~__GFP_RECLAIM);
> > >         noreclaim |= __GFP_NORETRY | __GFP_NOWARN;
> > > 
> > > possibly mapping has GFP_KERNEL, but this removes the GFP_RECLAIM part and adds
> > > __GFP_NORETRY | __GFP_NOWARN
> > > 
> > > if this fails (silently) there's a fallback
> > > 
> > > But when this reaches __read_swap_cache_async() it does:
> > > 
> > > /* May fail (-ENOMEM) if XArray node allocation failed. */
> > > err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL);
> > 
> > Yes, it seems to me that the problem is that i915 set GFP_NOWARN and
> > swap_state removed it.  It's been this way since 2008 when Hugh committed
> > f000944d03a5
> > 
> > I wouldn't have a problem with turning that '& GFP_KERNEL' into
> > '& GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY'.
> 
> Yes, I'd be fine with that too (with some parentheses perhaps).
> 
> Or (looking at what you used in __add_to_page_cache_locked()),
> would "gfp_mask & GFP_RECLAIM_MASK" be better? I think so,
> and guess you'd be glad to follow your own precedent.

Oh, again, I just moved code around.  Even though I did put it in
__add_to_page_cache_locked() with commit abc1be13fd11, I just moved it
from pagecache_get_page().  The real hero here is commit 45f87de57f8f
from Michael Hocko with honourable mention to commit dd56b0464267 by
Mel Gorman.

I always like to follow the precedent set in other places, and
GFP_RECLAIM_MASK is exactly intended for this purpose.  So yes, I
think this is the perfect patch.

> Quiz question: where would you expect GFP_RECLAIM_MASK to be defined?

Heh.  I don't think mm/internal.h is the right place for it either.
I'd've put it in linux/gfp.h.

> --- 5.7.0/mm/swap_state.c	2020-05-31 16:49:15.000000000 -0700
> +++ linux/mm/swap_state.c	2020-06-08 14:27:38.211813658 -0700
> @@ -23,6 +23,7 @@
>  #include <linux/huge_mm.h>
>  
>  #include <asm/pgtable.h>
> +#include "internal.h"
>  
>  /*
>   * swapper_space is a fiction, retained to simplify the path through
> @@ -418,7 +419,8 @@ struct page *__read_swap_cache_async(swp
>  		/* May fail (-ENOMEM) if XArray node allocation failed. */
>  		__SetPageLocked(new_page);
>  		__SetPageSwapBacked(new_page);
> -		err = add_to_swap_cache(new_page, entry, gfp_mask & GFP_KERNEL);
> +		err = add_to_swap_cache(new_page, entry,
> +					gfp_mask & GFP_RECLAIM_MASK);
>  		if (likely(!err)) {
>  			/* Initiate read into locked page */
>  			SetPageWorkingset(new_page);
> 

Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux