RE: [RFC PATCH v2 17/23] sched/fair: Fine-granularity NUMA balancing

From: Jianyong Wu

Date: Wed Sep 02 2026 - 02:46:52 EST



Hi Peter,

> -----Original Message-----
> From: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Sent: Tuesday, September 1, 2026 8:48 PM
> To: Jianyong Wu <wujianyong@xxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>; Juri Lelli <juri.lelli@xxxxxxxxxx>;
> Vincent Guittot <vincent.guittot@xxxxxxxxxx>; Chen Yu
> <yu.c.chen@xxxxxxxxx>; Tim Chen <tim.c.chen@xxxxxxxxxxxxxxx>; Dietmar
> Eggemann <dietmar.eggemann@xxxxxxx>; Steven Rostedt
> <rostedt@xxxxxxxxxxx>; Ben Segall <bsegall@xxxxxxxxxx>; Mel Gorman
> <mgorman@xxxxxxx>; Valentin Schneider <vschneid@xxxxxxxxxx>; K
> Prateek Nayak <kprateek.nayak@xxxxxxx>; Shrikanth Hegde
> <sshegde@xxxxxxxxxxxxx>; Phil Auld <pauld@xxxxxxxxxx>; Andrew
> Morton <akpm@xxxxxxxxxxxxxxxxxxxx>; David Hildenbrand
> <david@xxxxxxxxxx>; linux-kernel@xxxxxxxxxxxxxxx; linux-mm@xxxxxxxxx;
> jianyong.wu@xxxxxxxxxxx; Yuan Zhong <zhongyuan@xxxxxxxx>; Huangsj
> <huangsj@xxxxxxxx>; Fengyu Wang <wangfengyu@xxxxxxxx>; Zhiwei Ying
> <yingzhiwei@xxxxxxxx>; justin.he@xxxxxxx
> Subject: Re: [RFC PATCH v2 17/23] sched/fair: Fine-granularity NUMA
> balancing
>
> On Fri, Aug 28, 2026 at 10:07:31AM +0800, Jianyong Wu wrote:
> > NUMA balancing currently consists of two coupled components:
> > task migration and page migration. These two mechanisms work in
> tandem.
> > However, task migration may conflict with other subsystems such as CAS,
> > which aggregates tasks solely via task migration. Conflicts arise when
> > both CAS and NUMA balancing are enabled simultaneously.
> >
> > This patch addresses the problem by introducing a fine-grained NUMA
> > balancing mechanism, allowing task migration and page migration to
> > be enabled or disabled independently.
>
> Sorry, but this doesn't make sense.
>
> At every point NUMA migration should take precedence over LLC. The
> remote node penalty is much greater than the 'other' llc penalty.
>
> It is always beneficial to get tasks placed near the memory, and if
> tasks cannot be so moved, to move memory near to where the tasks are.
>
> As a secondary concern, it is beneficial to keep tasks constrained to a
> minimal set of LLCs inside this node.
>
> Disabling page-migration or numa task-migration separately completely
> wrecks things and you might as well just disable NUMA balancing.
>

Understood. My intention was to avoid conflicting task-migration decisions
between NUMA balancing and cache-aware scheduling. I agree that separating
NUMA task migration from page migration breaks the coordination between
task and memory placement. I will drop this patch.

I think patch 18, which folds the preferred nodes of all tasks in the
thread group into the scan range, may help mitigate the conflict between
CAS and NUMA balancing.

> Now, if the process spans multiple nodes we should go do the same again
> as this patch set does for llc, spread/interleave over the minimal set
> of nodes that do fit.

I think this patch set has the ability to spread threads into the minimal set of LLCs
even when the tasks span multiple nodes. This is the main aim of this patch set.

Thanks
Jianyong