Re: [PATCH 0/3] mm/mempolicy: add per-cgroup weighted interleave controls

From: Li Zhe

Date: Tue Nov 03 2026 - 21:45:44 EST


On 11/3/26 11:35 PM, Tejun Heo wrote:
> Hello, Zhe.
>
> On Tue, Nov 03, 2026 at 08:28:13PM +0800, Li Zhe wrote:
>> MPOL_WEIGHTED_INTERLEAVE currently has one system-wide weight table,
>> configured through sysfs or auto-derived from node bandwidth. This series
>> adds an optional BPF control plane that lets privileged BPF syscall
>> programs install manual weighted-interleave overrides for individual
>> cgroups.
> ...
>
> I don't think this has much to do with cgroups. Weighted interleave is
> already a per-thread/per-VMA policy chosen through set_mempolicy() and
> mbind(), and the weights are parameters of that policy. I think this
> should be tied to the memory policy instead. This is different from
> the per-cgroup NUMA balancing kfuncs. NUMA balancing has no per-task
> opt-in and acts on memory with no task context.
>
> Gregory Price's mempolicy2 series already proposed set_mempolicy2() and
> mbind2() with task-local weights:
>
> https://lore.kernel.org/all/20240103224209.2541-1-gregory.price@xxxxxxxxxxxx/


Hi Tejun. Thanks for taking a look.

I agree that MPOL_WEIGHTED_INTERLEAVE itself is selected by the task or
VMA through the existing mempolicy interfaces. This series is not trying
to make cgroups select that policy for tasks. A task still has to opt in
to MPOL_WEIGHTED_INTERLEAVE explicitly.

The part this series tries to make cgroup-scoped is the weight table.
Today that table is already outside struct mempolicy and is configured
as a system-wide administrative parameter. The problem we are trying to
solve is that different co-located workloads may need different DRAM/CXL
ratios while using the same MPOL_WEIGHTED_INTERLEAVE policy.

I have looked at the mempolicy2/mbind2 direction. It would model the
weights as task-local or VMA-local policy parameters, but it also requires
new syscall ABI and a much larger mempolicy UAPI extension. This BPF kfunc
interface was intended as a smaller administrative control plane for the
existing global-weight model: keep the existing mempolicy ABI, keep the
global sysfs table as the default, and allow a privileged manager to
install an override for a cgroup in the default hierarchy.

Does that distinction make the cgroup-scoped override acceptable? If not,
could you suggest a better way to support this kind of administrative
weight override without adding new mempolicy syscalls?

Thanks,
Zhe

>
> Thanks.
>
> --
> tejun