From: Matthew Wilcox <willy@infradead.org>
To: Hugh Dickins <hughd@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Chris Murphy <lists@colorremedies.com>,
Linux Memory Management List <linux-mm@kvack.org>,
Chris Wilson <chris@chris-wilson.co.uk>
Subject: Re: 5.7.0 page allocation failure: order:0, mode:0x400d0
Date: Mon, 8 Jun 2020 19:01:50 -0700 [thread overview]
Message-ID: <20200609020150.GY19604@bombadil.infradead.org> (raw)
In-Reply-To: <alpine.LSU.2.11.2006081321120.10251@eggly.anvils>
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@infradead.org>
next prev parent reply other threads:[~2020-06-09 2:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-06 7:38 Chris Murphy
2020-06-06 15:12 ` Matthew Wilcox
2020-06-07 0:50 ` Chris Murphy
2020-06-08 9:08 ` Vlastimil Babka
2020-06-08 11:44 ` Matthew Wilcox
2020-06-08 21:33 ` Hugh Dickins
2020-06-09 2:01 ` Matthew Wilcox [this message]
2020-06-10 15:21 ` Chris Murphy
2020-06-10 15:28 ` Chris Murphy
2020-06-10 23:31 ` Chris Murphy
2020-06-10 23:33 ` Matthew Wilcox
2020-06-10 23:43 ` Chris Murphy
2020-06-11 3:14 ` Chris Murphy
2020-06-15 20:29 ` Hugh Dickins
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=20200609020150.GY19604@bombadil.infradead.org \
--to=willy@infradead.org \
--cc=chris@chris-wilson.co.uk \
--cc=hughd@google.com \
--cc=linux-mm@kvack.org \
--cc=lists@colorremedies.com \
--cc=vbabka@suse.cz \
/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