Re: [PATCH] mm: mempolicy: fix automatic numa balancing for shmem

From: Gregory Price

Date: Tue Jun 30 2026 - 11:36:24 EST


On Tue, Jun 30, 2026 at 07:20:50PM +0800, Huang, Ying wrote:
> Gregory Price <gourry@xxxxxxxxxx> writes:
>
> [snip]
>
> > Demotions don't care about mempolicy, so opting shmem out of NUMA
> > balancing and mbind'ing on a tiered system is just full sadness.
> >
> > This is all just more evidence that demotion needs to be completely
> > redone, it's creating a mess of undefined behavior for memory placement.
>
> It's hard to respect mempolicy during demotion in the current
> implementation. Do you have any ideas on how to improve this?
>

I think it's feasible we could respect per-vma mempolicies, but not
per-task. That would at least make this particular interaction less
painful and mbind() would do what you'd expect. It is a bit racy,
but with MPOL_MF_MOVE_ALL the user can get what they actually want.

I think task-wide mempolicy is problematic and generally a bad idea
on tiered systems, maybe it's ok if we simply document task policies
are not respected on tiered systems?

~Gregory