* [PATCH] sched/numa: fix stale dst_nid used in distance calculation for candidate nodes
@ 2026-07-14 9:21 lirongqing
2026-07-31 14:07 ` 答复: " Li,Rongqing
0 siblings, 1 reply; 2+ messages in thread
From: lirongqing @ 2026-07-14 9:21 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, linux-kernel
Cc: Li RongQing
From: Li RongQing <lirongqing@baidu.com>
In task_numa_migrate(), when iterating over candidate NUMA nodes to
find a migration target beyond the preferred node, the distance is
computed as:
dist = node_distance(env.src_nid, env.dst_nid);
However, env.dst_nid still holds the value from the previous iteration
(or the preferred node on the first pass), not the current candidate
node 'nid'. The corrected distance is only assigned to env.dst_nid,
after it has already been used for scoring.
Fix it by computing the distance against the current candidate node:
dist = node_distance(env.src_nid, nid);
Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d78467e..a58c15a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3319,7 +3319,7 @@ static int task_numa_migrate(struct task_struct *p)
if (nid == env.src_nid || nid == p->numa_preferred_nid)
continue;
- dist = node_distance(env.src_nid, env.dst_nid);
+ dist = node_distance(env.src_nid, nid);
if (sched_numa_topology_type == NUMA_BACKPLANE &&
dist != env.dist) {
taskweight = task_weight(p, env.src_nid, dist);
--
2.9.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* 答复: [PATCH] sched/numa: fix stale dst_nid used in distance calculation for candidate nodes
2026-07-14 9:21 [PATCH] sched/numa: fix stale dst_nid used in distance calculation for candidate nodes lirongqing
@ 2026-07-31 14:07 ` Li,Rongqing
0 siblings, 0 replies; 2+ messages in thread
From: Li,Rongqing @ 2026-07-31 14:07 UTC (permalink / raw)
To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot,
Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
Valentin Schneider, K Prateek Nayak, linux-kernel
>
> From: Li RongQing <lirongqing@baidu.com>
>
> In task_numa_migrate(), when iterating over candidate NUMA nodes to find
> a migration target beyond the preferred node, the distance is computed as:
>
> dist = node_distance(env.src_nid, env.dst_nid);
>
> However, env.dst_nid still holds the value from the previous iteration (or the
> preferred node on the first pass), not the current candidate node 'nid'. The
> corrected distance is only assigned to env.dst_nid, after it has already been
> used for scoring.
>
> Fix it by computing the distance against the current candidate node:
>
> dist = node_distance(env.src_nid, nid);
>
ping
[Li,Rongqing]
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index d78467e..a58c15a
> 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -3319,7 +3319,7 @@ static int task_numa_migrate(struct task_struct
> *p)
> if (nid == env.src_nid || nid == p->numa_preferred_nid)
> continue;
>
> - dist = node_distance(env.src_nid, env.dst_nid);
> + dist = node_distance(env.src_nid, nid);
> if (sched_numa_topology_type == NUMA_BACKPLANE &&
> dist != env.dist) {
> taskweight = task_weight(p, env.src_nid, dist);
> --
> 2.9.4
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-31 14:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-14 9:21 [PATCH] sched/numa: fix stale dst_nid used in distance calculation for candidate nodes lirongqing
2026-07-31 14:07 ` 答复: " Li,Rongqing
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®