From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Gregory Price <gourry@gourry.net>,
linux-mm@kvack.org, willy@infradead.org, vbabka@kernel.org,
brendan.jackman@linux.dev
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
kernel-team@meta.com, jack@suse.cz, akpm@linux-foundation.org,
ziy@nvidia.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com,
ying.huang@linux.alibaba.com, surenb@google.com, mhocko@suse.com,
hannes@cmpxchg.org
Subject: Re: [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators
Date: Fri, 9 Oct 2026 22:55:05 +0200 [thread overview]
Message-ID: <df588805-6f97-4ef6-a64f-39222669bf3a@kernel.org> (raw)
In-Reply-To: <asdTptfeLkuypU8t@gourry-fedora-PF4VCD3F>
On 10/8/26 11:10, Gregory Price wrote:
> On Wed, Sep 23, 2026 at 05:10:34PM -0400, Gregory Price wrote:
>> This six-patch series first separates allocator behavior flags from
>> the bulk allocator fast-path flags and shares their validation and
>> preparation. It then passes alloc_flags through the MM-internal folio,
>> NUMA policy, filemap, and bulk helpers.
>
> I had various discussions this week regarding ALLOC_ZONELIST_PRIVATE and
> ALLOC_UNMAPPED, and whether adding alloc_flags to the APIs is a good/bad
> idea and what the alternatives are. I'd like to summarize the notes
> here and try to find a way forward.
>
> recommendations that were made:
>
> 1) re-use unused GFP flags
> #define __GFP_X __GFP_DMA
> or simply delete/replace __GFP_DMA
If so, I think the latter,
>
> There presently are no truly unused GFP flags, though there may be
> some users who can be shuffled around if we are willing to add
> functions.
I once had patches to convert __GFP_SKIP_ZERO and __GFP_SKIP_KASAN to alloc
flags instead. Nobody outside core-mm should be setting these, ever.
>
> 2) alias 2+ incompatible GFP flags to make a new one
> #define GFP_A (__GFP_NORETRY | __GFP_RETRY_MAYFAIL)
> #define GFP_B (__GFP_NORETRY | __GFP_NOFAIL)
> #define GFP_C (__GFP_NOFAIL | __GFP_RETRY_MAYFAIL)
> #define GFP_X (__GFP_DMA | __GFP_DMA32)
> #define GFP_Y (__GFP_DMA | __GFP_HIGHMEM)
> #define GFP_Z (__GFP_DMA32 | __GFP_HIGHMEM)
>
> These are all nonsensical combinations.
>
> Downside: We should probably just forbid these, otherwise the function
> contract just ends up being confusing - i.e. (__GFP_DMA | __GFP_DMA32)
> should just warn / return NULL.
>
Not a fan of this.
>
> 3) expose alloc_flags as mm-internal only flags (this series)
> in addition - convert some GFP flags to ALLOC flags
>
> In 99% of callers they would simply add ALLOC_DEFAULT (0).
>
> The upside - it seems like there are 2-3 GFP flags that may be
> good candidates for conversion to alloc flags:
> __GFP_WRITE
> __GFP_ZEROTAGS
> __GFP_SKIP_ZERO
Yes, as mentioned above that was my plan.
>
> And the zone/zonelist selectors seem like candidates to free up GFP
> flags by turning them into internal-only flags and giving drivers
> some kind of explicit API, e.g.:
> __GFP_DMA/__GFP_DMA32 -> dma_alloc(...) -> intenal ALLOC_DMA|32
>
> I considered whether __GFP_THISNODE should actually be broken up,
> as it actually means two things (don't oom, use thisnode zonelist)
> Something like:
> ALLOC_NO_OOM
> ALLOC_THISNODE_ZONELIST (or keep __GFP_THISNODE)
>
> The downside is yet another flag interface in the page allocator.
> Note: This is basically 1/2 way done, this series finishes it.
I do agree that two sets of flags is suboptimal, but likely more flexible. I
guess an alloc_flags only interface is not easily possible ...
I do wonder whether it should be:
typedef int __bitwise alloc_flags_t;
instead of "unsigned int alloc_flags".
... while at it
--
Cheers,
David
next prev parent reply other threads:[~2026-10-09 20:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 21:10 [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators Gregory Price
2026-09-23 21:10 ` [RFC PATCH 1/6] mm/page_alloc: clarify bulk allocator flag scope Gregory Price
2026-09-23 21:10 ` [RFC PATCH 2/6] mm/page_alloc: refactor alloc_flags preparation Gregory Price
2026-09-23 21:10 ` [RFC PATCH 3/6] mm/page_alloc: add an alloc_flags-aware folio allocator Gregory Price
2026-09-23 21:10 ` [RFC PATCH 4/6] mm/mempolicy: plumb alloc_flags through folio allocation Gregory Price
2026-09-23 21:10 ` [RFC PATCH 5/6] mm/filemap: " Gregory Price
2026-09-23 21:10 ` [RFC PATCH 6/6] mm/page_alloc: let the bulk allocator carry alloc_flags Gregory Price
2026-09-23 21:42 ` [RFC PATCH 0/6] mm: pass alloc_flags through folio, filemap, and bulk allocators Matthew Wilcox
2026-09-23 22:09 ` Gregory Price
2026-10-08 9:10 ` Gregory Price
2026-10-09 20:55 ` David Hildenbrand (Arm) [this message]
2026-10-09 23:28 ` Gregory Price
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=df588805-6f97-4ef6-a64f-39222669bf3a@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brendan.jackman@linux.dev \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=jack@suse.cz \
--cc=joshua.hahnjy@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=rakie.kim@sk.com \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
--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