Re: [PATCH v3 07/21] sched/cache: Introduce per CPU's tasks LLC preference counter
From: Peter Zijlstra
Date: Fri Feb 20 2026 - 05:46:17 EST
On Tue, Feb 10, 2026 at 02:18:47PM -0800, Tim Chen wrote:
> diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h
> index a4e2fb31f2fd..3aa6c101b2e4 100644
> --- a/include/linux/sched/topology.h
> +++ b/include/linux/sched/topology.h
> @@ -102,6 +102,10 @@ struct sched_domain {
> u64 max_newidle_lb_cost;
> unsigned long last_decay_max_lb_cost;
>
> +#ifdef CONFIG_SCHED_CACHE
> + unsigned int *pf;
So I'm all for short names; but perhaps this could be better. When
reading this my brain went page-fault, and then WTF :-)
> +#endif
> +
> #ifdef CONFIG_SCHEDSTATS
> /* sched_balance_rq() stats */
> unsigned int lb_count[CPU_MAX_IDLE_TYPES];
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index ca46b5cf7f78..dae78b5915a7 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2723,6 +2778,13 @@ build_sched_domains(const struct cpumask *cpu_map, struct sched_domain_attr *att
> }
> rcu_read_unlock();
>
> + /*
> + * Ensure we see enlarged sd->pf when we use new llc_ids and
> + * bigger max_llcs.
> + */
> + smp_mb();
> + max_llcs = tl_max_llcs;
This seems wrong. This is *after* cpu_attach_domain() which publishes
@sd. How about you do something like:
struct sched_domain {
...
unsigned int llc_max;
unsigned int *llc_counts __counted_by(llc_max);
}
Then you always carry matching information that is published together.
> if (has_asym)
> static_branch_inc_cpuslocked(&sched_asym_cpucapacity);
>
> --
> 2.32.0
>