Thread (19 messages) read the whole thread 19 messages, 5 authors, 2d ago

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

From: Gregory Price <gourry@gourry.net>
Date: 2026-07-20 17:40:44
Also in: linux-fsdevel, linux-iommu, linux-mm, linux-nfs, lkml, loongarch

On Thu, Jul 16, 2026 at 04:57:37PM +0000, Brendan Jackman wrote:
On Thu Jul 16, 2026 at 4:48 PM UTC, Matthew Wilcox wrote:
quoted
On Thu, Jul 16, 2026 at 02:30:10PM +0000, Brendan Jackman wrote:
quoted
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@amazon.com/ (local)
fwiw i've been fiddling with a module side mempolicy interface for a bit
to allow a clean guest_memfd() + mempolicy() interaction [0][1].

I saw this and thought "maybe, maybe not entirely".

there is definitely some oddities in the mempolicy uapi (internal-only
flags that are exposed to the uapi is odd) that some of the interface is
worth internalizing.

(fyi i've converted my private node work on top of the alloc_flags
 addition + new zonelists, new rfc is being posted today, your recent
 merges were timely).

~Gregory

[0] https://github.com/gourryinverse/linux/commit/b25bb27602fe512733450a97ac31ef4387b7e727
[1] https://github.com/gourryinverse/linux/commit/670f7dd81ef33a9385985a54b8ad6bc070b2d581
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help