Re: [RFC PATCH v2 0/3] BPF-based per-cgroup NUMA balancing mode selection

From: Yafang Shao

Date: Tue Oct 13 2026 - 23:24:34 EST


On Wed, Oct 14, 2026 at 2:02 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> Hello,
>
> On Tue, Oct 13, 2026 at 10:16:32AM +0800, Yafang Shao wrote:
> > Part of the consults are keyed on struct folio rather than struct
> > task_struct: the folio surface answers from the folio's memcg, the
> > owner's request, not the touching task's.
>
> Right, and I take the prctl() point too. It's stable uAPI and too rigid
> a bar for this.
>
> My suggestion is to start smaller. The op doesn't compute anything
> from its inputs. It returns a fixed mode per cgroup, and you don't
> need struct_ops for that.
>
> A kfunc that takes a cgid and a value would do: -1 for the system
> setting, otherwise the existing NUMA_BALANCING_* bitmask stored per
> cgroup. Task callsites read it through the task's cgroup, folio
> callsites through folio_memcg(). Same capability for the use case in
> the cover letter, a per-cgroup field and minimal plumbing, and the
> kfunc can grow later if a real decision-time policy shows up.

That's a good suggestion.

I believe that will be a good start for other per-cgroup memory
management features as well, such as per-cgroup THP. Also, it is
much easier to backport to older kernels and rapidly deploy them.

I will draft it soon.

--
Regards
Yafang