From: "Li,Rongqing" <lirongqing@baidu.com>
To: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
"K Prateek Nayak" <kprateek.nayak@amd.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: 答复: [PATCH] sched/numa: fix stale dst_nid used in distance calculation for candidate nodes
Date: Fri, 31 Jul 2026 14:07:52 +0000 [thread overview]
Message-ID: <9f8ac678065942ab8e6fc15debbe1447@baidu.com> (raw)
In-Reply-To: <20260714092110.1722-1-lirongqing@baidu.com>
>
> 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
prev parent reply other threads:[~2026-07-31 14:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 9:21 lirongqing
2026-07-31 14:07 ` Li,Rongqing [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f8ac678065942ab8e6fc15debbe1447@baidu.com \
--to=lirongqing@baidu.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®