Messages in this thread | | | Date | Tue, 22 Aug 2023 07:12:44 -0400 | Subject | Re: [RFC PATCH v2 2/3] sched: Introduce cpus_share_l2c | From | Mathieu Desnoyers <> |
| |
On 8/22/23 03:58, Aaron Lu wrote: > On Sat, Aug 19, 2023 at 08:31:55AM -0400, Mathieu Desnoyers wrote: >> +#ifdef TOPOLOGY_CLUSTER_SYSFS >> +static int cpu_get_l2c_info(int cpu, int *l2c_size, int *l2c_id) >> +{ >> + const struct cpumask *cluster_mask = topology_cluster_cpumask(cpu); >> + >> + *l2c_size = cpumask_weight(cluster_mask); >> + *l2c_id = cpumask_first(cluster_mask); >> + return 0; >> +} >> +#else >> +static int cpu_get_l2c_info(int cpu, int *l2c_size, int *l2c_id) >> +{ >> + return -1; >> +} >> +#endif >> + >> static void update_top_cache_domain(int cpu) >> { >> struct sched_domain_shared *sds = NULL; >> struct sched_domain *sd; >> - int id = cpu; >> - int size = 1; >> + int id = cpu, size = 1, l2c_id, l2c_size; >> >> sd = highest_flag_domain(cpu, SD_SHARE_PKG_RESOURCES); >> if (sd) { >> @@ -686,6 +704,14 @@ static void update_top_cache_domain(int cpu) >> sds = sd->shared; >> } >> >> + if (cpu_get_l2c_info(cpu, &l2c_id, &l2c_size)) { > > Should be: cpu_get_l2c_info(cpu, &l2c_size, &l2c_id)
Good point! Thanks for spotting it. I will fix it in a v3.
Mathieu
> >> + /* Fallback on using LLC. */ >> + l2c_size = size; >> + l2c_id = id; >> + } >> + per_cpu(sd_l2c_size, cpu) = l2c_size; >> + per_cpu(sd_l2c_id, cpu) = l2c_id; >> + >> rcu_assign_pointer(per_cpu(sd_llc, cpu), sd); >> per_cpu(sd_llc_size, cpu) = size; >> per_cpu(sd_llc_id, cpu) = id; >> -- >> 2.39.2 >>
-- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com
| |