[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251216203243.GJ905277@cmpxchg.org>
Date: Tue, 16 Dec 2025 15:32:43 -0500
From: Johannes Weiner <hannes@...xchg.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Suren Baghdasaryan <surenb@...gle.com>,
Michal Hocko <mhocko@...e.com>,
Brendan Jackman <jackmanb@...gle.com>, Zi Yan <ziy@...dia.com>,
David Rientjes <rientjes@...gle.com>,
David Hildenbrand <david@...nel.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Mike Rapoport <rppt@...nel.org>,
Joshua Hahn <joshua.hahnjy@...il.com>,
Pedro Falcato <pfalcato@...e.de>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 2/2] mm, page_alloc: fail costly __GFP_NORETRY
allocations faster
On Tue, Dec 16, 2025 at 04:54:22PM +0100, Vlastimil Babka wrote:
> It might make therefore more sense to just fail unconditionally after
> the initial compaction attempt, so do that instead. Costly allocations
> that do want the reclaim/compaction to happen at least once can omit
> __GFP_NORETRY, or even specify __GFP_RETRY_MAYFAIL for more than one
> attempt.
>
> There is a slight potential unfairness in that costly __GFP_NORETRY
> allocations that can't perform direct compaction (i.e. lack __GFP_IO)
> will still be allowed to direct reclaim, while those that can direct
> compact will now never attempt direct reclaim. However, in cases of
> memory pressure causing compaction to be skipped due to insufficient
> base pages, direct reclaim was already not done before, so there should
> be no functional regressions from this change.
Hm, kind of. There could be enough basepages for compaction_suitable()
but compaction odds are still higher with more free pages. So there
might be cases it regresses.
__GFP_NORETRY semantics say it'll try reclaim at least once. We should
be able to keep that and still simplify, no?
> if (costly_order && (gfp_mask & __GFP_NORETRY)) {
> - if (gfp_mask & __GFP_THISNODE)
> - goto nopage;
> + goto nopage;
IOW, maybe directly select for the NUMA-THP special case here?
/* Optimistic node-local huge page - only compact once */
if (costly_order &&
((gfp_mask & (__GFP_NORETRY|__GFP_THISNODE)) ==
(__GFP_NORETRY|__GFP_THISNODE)))
goto nopage;
and then let other __GFP_NORETRY fall through.
Powered by blists - more mailing lists