Linux filesystem development
 help / color / mirror / Atom feed
From: Harry Yoo <harry@kernel.org>
To: "Kiryl Shutsemau (Meta)" <kas@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 13:12:34 +0000	[thread overview]
Message-ID: <axK6nSmiF7FYG4kM@thinkstation> (raw)
In-Reply-To: <axHjfsDZpq0Oj3-W@shutemov.name>

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.

> Buffered writes to a block device look like they hit this: the bdev
> mapping is GFP_USER, so its large folios are unmovable, and
> __filemap_get_folio_mpol() steps down through orders 3, 2 and 1 with
> __GFP_NORETRY. With this patch the costly orders fail fast, but each of
> the three small ones still pays for a pageblock_order pass.

Sounds like we'd need a follow-up for this?
What do you think, Salvatore?

-- 
Cheers,
Harry / Hyeonggon

  reply	other threads:[~2026-12-04 13:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-01  8:21 [PATCH v6] mm/page_alloc: avoid direct reclaim and compaction for costly __GFP_NORETRY allocations 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 [this message]
2026-12-04 22:45       ` Kiryl Shutsemau (Meta)

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=axK6nSmiF7FYG4kM@thinkstation \
    --to=harry@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=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=jackmanb@google.com \
    --cc=kas@kernel.org \
    --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