From: Salvatore Dipietro <dipiets@amazon.it>
To: <akpm@linux-foundation.org>, <hannes@cmpxchg.org>
Cc: <abuehaze@amazon.com>, <alisaidi@amazon.com>,
<blakgeof@amazon.com>, <brauner@kernel.org>,
<brendan.jackman@linux.dev>, <david@redhat.com>, <dgc@kernel.org>,
<dipietro.salvatore@gmail.com>, <dipiets@amazon.it>,
<djwong@kernel.org>, <hch@infradead.org>, <hch@lst.de>,
<jackmanb@google.com>, <linux-fsdevel@vger.kernel.org>,
<linux-kernel@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>, <vbabka@suse.cz>, <willy@infradead.org>,
<ziy@nvidia.com>
Subject: Re: [PATCH v5] mm/page_alloc: avoid direct compaction for costly __GFP_NORETRY allocations
Date: Tue, 15 Sep 2026 16:00:42 +0000 [thread overview]
Message-ID: <20260915160042.1265958-1-dipiets@amazon.it> (raw)
In-Reply-To: <20260911093209.d9181d5950778897935f6bcb@linux-foundation.org>
On Fri, 11 Sep 2026 09:32:00 -0700 Andrew Morton <akpm@linux-foundation.org> wrote:
> does any of this look real?
The mechanism seems real, but it only shows up with vm.defrag_mode=1,
which is off by default.
With defrag_mode=1, a costly __GFP_NORETRY allocation that used to fail
cleanly can now succeed by fragmenting another migratetype's pageblock,
which seems like the wrong trade for a caller whose premise is a cheap
lower-order fallback. Johannes, do we want to keep it strict?
If so, we could add a condition like below. It is equally
applicable to v4 and v5. Happy to send it separately or in v6.
/*
* Reclaim/compaction cannot run, so defrag_mode's strategy
* of enforcing ALLOC_NOFRAGMENT cannot be fulfilled. Allow
* fallbacks rather than failing the allocation outright.
* Not for costly __GFP_NORETRY: those have a cheap lower
* order fallback, so failing beats fragmenting.
*/
if (defrag_mode && (alloc_flags & ALLOC_NOFRAGMENT) &&
!(costly_order && (gfp_mask & __GFP_NORETRY)) &&
(gfp_mask & __GFP_KSWAPD_RECLAIM)) {
alloc_flags &= ~ALLOC_NOFRAGMENT;
goto retry;
}
Salvatore
AMAZON DEVELOPMENT CENTER ITALY SRL, viale Monte Grappa 3/5, 20124 Milano, Italia, Registro delle Imprese di Milano Monza Brianza Lodi REA n. 2504859, Capitale Sociale: 10.000 EUR i.v., Cod. Fisc. e P.IVA 10100050961, Societa con Socio Unico
next prev parent reply other threads:[~2026-09-15 16:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 14:21 Salvatore Dipietro
2026-09-11 15:37 ` Zi Yan
2026-09-11 16:32 ` Andrew Morton
2026-09-15 16:00 ` Salvatore Dipietro [this message]
2026-09-15 16:17 ` Johannes Weiner
2026-09-11 20:44 ` Johannes Weiner
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=20260915160042.1265958-1-dipiets@amazon.it \
--to=dipiets@amazon.it \
--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=david@redhat.com \
--cc=dgc@kernel.org \
--cc=dipietro.salvatore@gmail.com \
--cc=djwong@kernel.org \
--cc=hannes@cmpxchg.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=vbabka@kernel.org \
--cc=vbabka@suse.cz \
--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®