Re: [PATCH v5 2/2] sched/numa: add statistics of numa balance task

From: Chen, Yu C
Date: Thu Jun 19 2025 - 09:04:33 EST


On 6/17/2025 5:30 PM, Michal Koutný wrote:
On Tue, Jun 03, 2025 at 10:46:06PM +0800, "Chen, Yu C" <yu.c.chen@xxxxxxxxx> wrote:
My understanding is that the "misplaced" container is not strictly tied
to set_mempolicy or cpuset configuration, but is mainly caused by the
scheduler's generic load balancer.

You are convincing me with this that, cpu.stat fits the concept better.
Doesn't that sound like that to you?

Regarding the threaded subtrees mode, I was previously unfamiliar with
it and have been trying to understand it better.

No problem.

If I understand correctly, if threads within a single process are
placed in different cgroups via cpuset, we might need to scan
/proc/<PID>/sched to collect NUMA task migration/swap statistics.

The premise of your series was that you didn't want to do that :-)

I agree with your prior point that NUMA balancing task activity is not
directly
associated with either the Memory controller or the CPU controller. Although
showing this data in cpu.stat might seem more appropriate, we expose it in
memory.stat due to the following trade-offs(or as an exception for
NUMA balancing):

1.It aligns with existing NUMA-related metrics already present in
memory.stat.

That one I'd buy into. OTOH, I'd hope this could be overcome with
documentation.

2.It simplifies code implementation.

I'd say that only applies when accepting memory.stat as the better
place. I think the appropriately matching API should be picked first and
implementation is only secondary to that.

Thanks for this guidance.

From your reasoning above, I think that the concept is closer to be in
cpu.stat ¯\_(ツ)_/¯

OK. Since this change has already been addressed in upstream kernel,
I can update the numa_task_migrated/numa_task_swapped fields in
Documentation/admin-guide/cgroup-v2.rst to mention that, these
activities are not memory related but put here because they are
closer to numa balance's page statistics.
Or do you want me to submit a patch to move the items from
memory.stat to cpu.stat?

thanks,
Chenyu



Michal