Re: [PATCH v2 06/23] sched/cache: Track LLC-preferred tasks per runqueue

From: Peter Zijlstra
Date: Tue Dec 09 2025 - 07:19:14 EST


On Wed, Dec 03, 2025 at 03:07:25PM -0800, Tim Chen wrote:


> #ifdef CONFIG_SCHED_CACHE
> struct callback_head cache_work;
> + /*the p is currently refcounted in a rq's preferred llc stats*/

Shall we have spaces after and before the comment marks?

Also, comment confuses me, I don't see get_task_struct() /
put_task_struct() usage. Did you mean something else with refcount?

> + bool sched_llc_active;
> int preferred_llc;
> #endif

> +static void account_llc_dequeue(struct rq *rq, struct task_struct *p)
> +{
> + int pref_llc;
> +
> + /*
> + * Borrow the uc_se->active from uclamp_rq_inc_id(),
> + * uclamp_rq_dec_id() to avoid the unbalanced calculation
> + * of rq statistics.
> + */
> + if (unlikely(!p->sched_llc_active))
> + return;

Another very confusing comment; what? Also, can you please explain (in
the new comment) how we get here without having llc_active set?

> +
> + pref_llc = p->preferred_llc;
> + if (pref_llc < 0)
> + return;
> +
> + rq->nr_llc_running--;
> + rq->nr_pref_llc_running -= (pref_llc == task_llc(p));
> + p->sched_llc_active = false;
> +}