Re: [PATCH 09/19] sched/fair: Count tasks prefering each LLC in a sched group

From: Tim Chen

Date: Mon Oct 27 2025 - 19:21:00 EST


On Mon, 2025-10-27 at 14:03 +0530, K Prateek Nayak wrote:
> Hello Tim,
>
> On 10/11/2025 11:54 PM, Tim Chen wrote:
> > +#ifdef CONFIG_SCHED_CACHE
> > + if (sched_cache_enabled()) {
> > + int j;
> > +
> > + for (j = 0; j < max_llcs; ++j)
> > + sgs->nr_pref_llc[j] += rq->nr_pref_llc[j];
> > + }
> > +#endif
>
> If I'm not mistaken, we only compare
> "sds->nr_pref_llc[llc_idx(env->dst_cpu)]"
> and the destination LLC is always fixes. Do we need to aggregate the
> data for all the LLCs? Is a single "nr_pref_llc_dest" enough?

Yes. Only the nr_pref_llc entry corresponding to the destination
LLC is going to be used later to find either the LLC or run queue
to be chosen for balancing. We can skip accounting for the other LLCs and save
some memory here.

Tim

>
> > /*
> > * No need to call idle_cpu() if nr_running is not 0
> > */