Re: [RFC PATCH 2/3] sched: Introduce cpus_share_l2c

From: Mathieu Desnoyers
Date: Fri Aug 18 2023 - 11:40:10 EST


On 8/18/23 11:30, Mathieu Desnoyers wrote:
[...]
+ cluster_mask = topology_cluster_cpumask(cpu);
+ l2c_size = cpumask_weight(cluster_mask);
+ if (l2c_size == 1) {
+ /* Fallback on using LLC. */
+ l2c_size = size;
+ l2c_id = id;
+ }

For the fallback case, this should be:

cluster_mask = topology_cluster_cpumask(cpu);
l2c_size = cpumask_weight(cluster_mask);
if (l2c_size == 1) {
/* Fallback on using LLC. */
l2c_size = size;
l2c_id = id;
} else {
l2c_id = cpumask_first(cluster_mask);
}
per_cpu(sd_l2c_id, cpu) = l2c_id;
per_cpu(sd_l2c_size, cpu) = l2c_size;

Thanks,

Mathieu


+ l2c_id = cpumask_first(cluster_mask);
+ per_cpu(sd_l2c_id, cpu) = l2c_id;
+ per_cpu(sd_l2c_size, cpu) = l2c_size;
+
rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
per_cpu(sd_llc_size, cpu) = size;
per_cpu(sd_llc_id, cpu) = id;

--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com