From: Waiman Long <llong@redhat.com>
To: Chuyi Zhou <zhouchuyi@bytedance.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
vschneid@redhat.com, riel@surriel.com
Cc: chengming.zhou@linux.dev, kprateek.nayak@amd.com,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] sched/fair: Ignore isolated cpus in update_numa_stat
Date: Tue, 7 Jan 2025 13:39:36 -0500 [thread overview]
Message-ID: <dfd170e2-2ee9-4e50-9e86-aad612a976ce@redhat.com> (raw)
In-Reply-To: <20250103065930.413464-3-zhouchuyi@bytedance.com>
On 1/3/25 1:59 AM, Chuyi Zhou wrote:
> Now update_numa_stats() iterates each cpu in a node to gather load
> information for the node and attempts to find the idle cpu as a candidate
> best_cpu within the node.
>
> In update_numa_stats() we should take into account the scheduling domain.
> This is because the "isolcpus" kernel command line option and cpuset iso-
> late partitions can remove CPUs from load balance. Similar to task wakeup
> and periodic load balancing, we should not involve isolated CPUs in NUMA
> balancing. When gathering load information for nodes, we need to ignore the
> load of isolated CPUs. This change also avoids selecting an isolated CPU
> as the idle_cpu.
>
> Signed-off-by: Chuyi Zhou <zhouchuyi@bytedance.com>
> ---
> kernel/sched/fair.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index f544012b9320..a0139659fe7a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2125,6 +2125,11 @@ static void update_numa_stats(struct task_numa_env *env,
> for_each_cpu(cpu, cpumask_of_node(nid)) {
> struct rq *rq = cpu_rq(cpu);
>
> + /* skip isolated cpus' load */
> + if (!rcu_dereference(rq->sd))
> + continue;
> +
> + ns->weight++;
> ns->load += cpu_load(rq);
> ns->runnable += cpu_runnable(rq);
> ns->util += cpu_util_cfs(cpu);
> @@ -2144,8 +2149,6 @@ static void update_numa_stats(struct task_numa_env *env,
> }
> rcu_read_unlock();
>
> - ns->weight = cpumask_weight(cpumask_of_node(nid));
> -
> ns->node_type = numa_classify(env->imbalance_pct, ns);
>
> if (idle_core >= 0)
You should initalize ns->weight to 0 first before iteration to prevent
pre-existing ns->weight value from corrupting the result.
Cheers,
Longman
next prev parent reply other threads:[~2025-01-07 18:39 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 6:59 [PATCH v2 0/3] Take the scheduling domain into account in numa balancin Chuyi Zhou
2025-01-03 6:59 ` [PATCH v2 1/3] sched/fair: Remove unused task_numa_migrate return value Chuyi Zhou
2025-01-05 18:28 ` Madadi Vineeth Reddy
2025-01-03 6:59 ` [PATCH v2 2/3] sched/fair: Ignore isolated cpus in update_numa_stat Chuyi Zhou
2025-01-05 18:52 ` Madadi Vineeth Reddy
2025-01-07 13:16 ` Chuyi Zhou
2025-01-07 18:30 ` Madadi Vineeth Reddy
2025-01-07 18:39 ` Waiman Long [this message]
2025-01-08 10:47 ` Chuyi Zhou
2025-01-03 6:59 ` [PATCH v2 3/3] sched/fair: Ensure select housekeeping cpus in task_numa_find_cpu Chuyi Zhou
2025-01-03 11:36 ` [PATCH v2 0/3] Take the scheduling domain into account in numa balancin Peter Zijlstra
2025-01-03 12:40 ` Chuyi Zhou
2025-01-07 10:48 ` Peter Zijlstra
2025-01-07 13:03 ` Chuyi Zhou
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=dfd170e2-2ee9-4e50-9e86-aad612a976ce@redhat.com \
--to=llong@redhat.com \
--cc=bsegall@google.com \
--cc=chengming.zhou@linux.dev \
--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=riel@surriel.com \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=zhouchuyi@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.