Re: [PATCH 2/3] sched/fair: Ignore isolated cpus in update_numa_stat

From: K Prateek Nayak
Date: Wed Dec 18 2024 - 01:26:37 EST


Hello Chuyi,

On 12/16/2024 5:53 PM, Chuyi Zhou wrote:
[..snip..] @@ -2125,6 +2125,11 @@ static void update_numa_stats(struct task_numa_env *env,
for_each_cpu(cpu, cpumask_of_node(nid)) {

Looking at sched_init_domains(), we only build sched domains only for
active CPUs in housekeeping_cpumask(HK_TYPE_DOMAIN) so similar to the
question on Patch 3, can we get away with just modifying this outer loop
to:

for_each_cpu_and(cpu, cpumask_of_node(nid), housekeeping_cpumask(HK_TYPE_DOMAIN)) {
...
}

Thoughts?

--
Thanks and Regards,
Prateek

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)