From: "Kiryl Shutsemau (Meta)" <kas@kernel.org>
To: Harry Yoo <harry@kernel.org>
Cc: Salvatore Dipietro <dipiets@amazon.it>,
linux-kernel@vger.kernel.org, hch@infradead.org,
abuehaze@amazon.com, akpm@linux-foundation.org,
alisaidi@amazon.com, blakgeof@amazon.com, brauner@kernel.org,
dgc@kernel.org, dipietro.salvatore@gmail.com, djwong@kernel.org,
hannes@cmpxchg.org, jackmanb@google.com,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-xfs@vger.kernel.org, mhocko@suse.com,
ritesh.list@gmail.com, rvvandan@amazon.com,
stable@vger.kernel.org, surenb@google.com, vbabka@kernel.org,
willy@infradead.org, ziy@nvidia.com,
David Hildenbrand <david@redhat.com>,
Christoph Hellwig <hch@lst.de>, Dmitry Ilvokhin <d@ilvokhin.com>,
Brendan Jackman <brendan.jackman@linux.dev>,
usama.arif@linux.dev
Subject: Re: [PATCH v6] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations
Date: Fri, 4 Dec 2026 14:45:51 -0800 [thread overview]
Message-ID: <axNCXqd77MnUVhlO@shutemov.name> (raw)
In-Reply-To: <axK6nSmiF7FYG4kM@thinkstation>
On Fri, Dec 04, 2026 at 01:12:34PM +0000, Harry Yoo wrote:
> On Thu, Dec 03, 2026 at 02:05:24PM -0800, Kiryl Shutsemau (Meta) wrote:
> > On Mon, Nov 30, 2026 at 01:27:02PM +0000, Harry Yoo wrote:
> > > > @@ -4802,6 +4802,18 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
> > > > bool can_retry_reserves = true;
> > > > unsigned long alloc_start_time = jiffies;
> > > >
> > > > + /*
> > > > + * Costly __GFP_NORETRY callers have a cheap fallback, so don't stall
> > > > + * them in reclaim or compaction. __GFP_THISNODE callers are exempt.
> > > > + */
> > > > + if (costly_order && (gfp_mask & __GFP_NORETRY) &&
> > > > + !(gfp_mask & __GFP_THISNODE))
> > > > + gfp_mask &= ~__GFP_DIRECT_RECLAIM;
> > >
> > > Does this apply when the order is not costly but reclaim_compact_order
> > > is promoted to a costly order by defrag_mode?
> >
> > No, the check uses the request order and the promotion happens later.
> >
> > I think the question is whether, under defrag_mode, a __GFP_NORETRY
> > request whose reclaim and compaction get promoted to pageblock_order
> > should skip direct reclaim like a costly one does.
>
> Yes, that's what I meant. Thanks.
>
> > Such a request of order 1-3 currently compacts at pageblock_order,
> > reclaims at pageblock_order and compacts again, then fails without
> > dropping ALLOC_NOFRAGMENT.
>
> which should be avoided given the purpose of this patch.
I am not sure. I can see it both ways.
The request is not costly, but under defrag_mode the only way to serve
it is costly work: reclaim and compaction at pageblock_order. That is
what this patch spares costly __GFP_NORETRY requests.
On the other hand, non-costly requests are expected to reclaim and
compact. If these skip it, block device writes get order-0 folios
whenever no free unmovable chunk is around, even when one pass could
have made a whole block for them.
--
Kiryl Shutsemau / Kirill A. Shutemov
prev parent reply other threads:[~2026-12-04 22:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 8:21 Salvatore Dipietro
2026-10-02 1:29 ` Andrew Morton
2026-10-02 8:23 ` Vlastimil Babka (SUSE)
2026-10-02 22:28 ` Andrew Morton
2026-11-04 19:11 ` Thadeu Lima de Souza Cascardo
2026-11-05 8:15 ` Vlastimil Babka (SUSE)
2026-11-30 13:27 ` Harry Yoo
2026-12-03 22:05 ` Kiryl Shutsemau (Meta)
2026-12-04 13:12 ` Harry Yoo
2026-12-04 22:45 ` Kiryl Shutsemau (Meta) [this message]
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=axNCXqd77MnUVhlO@shutemov.name \
--to=kas@kernel.org \
--cc=abuehaze@amazon.com \
--cc=akpm@linux-foundation.org \
--cc=alisaidi@amazon.com \
--cc=blakgeof@amazon.com \
--cc=brauner@kernel.org \
--cc=brendan.jackman@linux.dev \
--cc=d@ilvokhin.com \
--cc=david@redhat.com \
--cc=dgc@kernel.org \
--cc=dipietro.salvatore@gmail.com \
--cc=dipiets@amazon.it \
--cc=djwong@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=harry@kernel.org \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=jackmanb@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-xfs@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=ritesh.list@gmail.com \
--cc=rvvandan@amazon.com \
--cc=stable@vger.kernel.org \
--cc=surenb@google.com \
--cc=usama.arif@linux.dev \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
--cc=ziy@nvidia.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
all inboxes | Powered by JetHome®