Re: [PATCH] pipe: Prefer mempolicy node for metadata allocations
From: Andrea Righi
Date: Thu Nov 19 2026 - 11:11:49 EST
Hi Gregory,
On Thu, Nov 19, 2026 at 10:54:11AM -0500, Gregory Price (Meta) wrote:
> On 2026-11-11 07:48 +0100, Andrea Righi wrote:
> >
> > Vlastimil, Gregory, do you think this SLUB locality and mempolicy
> > aspects makes sense here? In particular, does preferring the policy node
> > for slab-sized pipe metadata, while retaining the policy-aware path for
> > larger arrays, look reasonable?
> >
>
> Funny enough I was leaning toward task mempolicy being ignored for
> non-__GFP_ACCOUNT allocations but SLAB_ACCOUNT makes this a bit
> complicated. This would be another scenario I have to consider.
>
> (related but not directly problematic with the change here)
> https://lore.kernel.org/all/20260701222112.2820098-1-gourry@xxxxxxxxxx/
Thanks for looking at this, and sorry, I just noticed your email right
after sending a v2
(https://lore.kernel.org/r/20261119160430.1113397-1-arighi@xxxxxxxxxx/).
This new version doesn't change where new slabs are allocated: it only
stops the remote partial scan from returning objects outside the
MPOL_BIND nodemask, in the cases where new slabs would be allocated
within it anyway.
I think it should be compatible with your series: the nodemask is used
only when the page allocator would also apply the policy to new slabs,
so the same filter for unaccounted allocations can be added there.
>
> As a rule I generally think depending on userland mempolicy
> to direct kernel memory placement is fragile and unreliable,
> but your results are interesting.
>
> General notes - I dislike direct current->mempolicy access in
> random places in MM, and dislike any MPOL mode checking outside
> mempolicy.c - but sometimes it's necessary.
Agreed, in v2 all the mempolicy logic is in a new helper in mempolicy.c
(mempolicy_slab_nodemask()), SLUB only gets a nodemask from it.
>
> I'm not against slab having better numa awareness, it makes sense
> you'd want to prefer the metadata to live close as well.
>
> Give me a bit more time to wrap my head around this, sorry for the
> delayed reply, things have been a bit chaotic this past month.
No problem! Take your time.
Thanks,
-Andrea