Re: [PATCH] mm: mempolicy: fix automatic numa balancing for shmem
From: Huang, Ying
Date: Wed Jul 01 2026 - 07:06:16 EST
Gregory Price <gourry@xxxxxxxxxx> writes:
> 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.
Yes. Per-vma mempolicy support is possible.
> 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?
Anyway, it's convenient to use numactl to manage mempolicy.
Is it possible to enable NUMA_BALANCING_MEMORY_TIERING for non-default
VMAs? If we don't enable NUMA_BALANCING_NORMAL, the overhead should be
OK because the page table entries are changed to PROTN_ONE only for
pages on the slow tier.
Additionally, we may need to consider cpusets.
---
Best Regards,
Huang, Ying