Re: [PATCH v3 09/21] sched/cache: Count tasks prefering destination LLC in a sched group

From: Chen, Yu C

Date: Fri Feb 20 2026 - 21:54:01 EST


On 2/20/2026 9:43 PM, Peter Zijlstra wrote:
On Fri, Feb 20, 2026 at 01:52:48PM +0100, Peter Zijlstra wrote:
On Tue, Feb 10, 2026 at 02:18:49PM -0800, Tim Chen wrote:

@@ -11034,6 +11037,9 @@ static inline void update_sg_lb_stats(struct lb_env *env,
{
int i, nr_running, local_group, sd_flags = env->sd->flags;
bool balancing_at_rd = !env->sd->parent;
+#ifdef CONFIG_SCHED_CACHE
+ int dst_llc = llc_id(env->dst_cpu);
+#endif
memset(sgs, 0, sizeof(*sgs));
@@ -11054,6 +11060,15 @@ static inline void update_sg_lb_stats(struct lb_env *env,
if (cpu_overutilized(i))
*sg_overutilized = 1;
+#ifdef CONFIG_SCHED_CACHE
+ if (sched_cache_enabled() && llc_id(i) != dst_llc) {

If you write that like:

if (sched_cache_enabled && llc_id(i) != llc_id(env->dst_cpu))

You can get rid of that dst_llc variable, but more importantly its
ifdeffery.

Ah, you're perhaps wanting to not re-load on the dst_llc usage below?

Yes.

Do the compilers DTRT when you mark llc_id() as __pure?

OK, we will have a try on this.

thanks,
Chenyu