Re: [PATCH 1/3] mm: move internal mempolicy APIs to new internal header

From: Brendan Jackman

Date: Thu Jul 16 2026 - 12:58:29 EST


On Thu Jul 16, 2026 at 4:48 PM UTC, Matthew Wilcox wrote:
> On Thu, Jul 16, 2026 at 02:30:10PM +0000, Brendan Jackman wrote:
>> There are no external users for this surface, reduce the scope.
>> -struct folio *folio_alloc_mpol_noprof(gfp_t gfp, unsigned int order,
>> - struct mempolicy *mpol, pgoff_t ilx, int nid);
>
> Hm. So what we're saying is that allocations which respect mempolicy are
> only for core mm and not for, eg, device drivers to do. Is that really
> what we want to say? I don't think so, because that's inconsistent
> with having just widened __filemap_get_folio_mpol to allow guest_memfd
> to specify a mempolicy.

Yeah I agree, mempolicy definitely seems like a "public concept".  All
I'm saying here is this specific function doesn't have any external
users so it doesn't need to be an external header.

... With the ulterior motive that I want to add a new parameter to it
that actually _is_ mm-internal. Namely, alloc_flags, so I can add
ALLOC_UNMAPPED to implement AS_NO_DIRECT_MAP, i.e. the next iteration of
[0]. So basically this is
about trying to extend the allocator without creating a GFP flag.

So I'm envisaging if an external user arises for it later, we'd slap two
underscores on the beginning of the internal one, (with the alloc_flags
arg), and then bring back the public one as a wrapper.

Does that make sense?

[0]: https://lore.kernel.org/all/20260410151746.61150-1-kalyazin@xxxxxxxxxx/