Re: [PATCH v2 06/23] sched/cache: Track LLC-preferred tasks per runqueue
From: Chen, Yu C
Date: Wed Dec 17 2025 - 08:08:51 EST
On 12/17/2025 6:04 PM, Vern Hao wrote:
On 2025/12/4 07:07, Tim Chen wrote:
@@ -1346,8 +1385,13 @@ void account_mm_sched(struct rq *rq, struct task_struct *p, s64 delta_exec)I am a little concerned that there might be cases where both |p- >preferred_llc| and |mm_sched_llc| are equal to -1 at this point.", Is it necessary to add a check here?
#endif
}
- if (p->preferred_llc != mm_sched_llc)
+ /* task not on rq accounted later in account_entity_enqueue() */
+ if (task_running_on_cpu(rq->cpu, p) &&
+ p->preferred_llc != mm_sched_llc) {
#ifdef CONFIG_NUMA_BALANCING
/*
* Don't assign preferred LLC if it
* conflicts with NUMA balancing.
*/
if (p->numa_preferred_nid >= 0 &&
cpu_to_node(mm->mm_sched_cpu) != p- >numa_preferred_nid)
mm_sched_llc = -1;
#endif
}
/* task not on rq accounted later in account_entity_enqueue() */
if (task_running_on_cpu(rq->cpu, p) &&
p->preferred_llc != mm_sched_llc) {
account_llc_dequeue(rq, p);
p->preferred_llc = mm_sched_llc;
account_llc_enqueue(rq, p);
}
Are you concerned about the mismatch between the percpu runqueue values
of nr_pref_llc_running, nr_pref_llc, and nr_llc_running? This should not
be an issue, because account_llc_dequeue() and account_llc_enqueue() are
always invoked together in account_mm_sched(). If p->preferred_llc = mm_sched_llc = -1,
account_llc_dequeue/enqueue() will not be invoked, so it is still paired.
Please let me know if I understand your comments correctly.
thanks,
Chenyu