Re: [PATCH 02/19] sched/fair: Record per-LLC utilization to guide cache-aware scheduling decisions
From: Peter Zijlstra
Date: Wed Oct 15 2025 - 06:15:54 EST
On Sat, Oct 11, 2025 at 11:24:39AM -0700, Tim Chen wrote:
> +static void record_sg_llc_stats(struct lb_env *env,
> + struct sg_lb_stats *sgs,
> + struct sched_group *group)
> +{
> + /*
> + * Find the child domain on env->dst_cpu. This domain
> + * is either the domain that spans this group(if the
> + * group is a local group), or the sibling domain of
> + * this group.
> + */
> + struct sched_domain *sd = env->sd->child;
> + struct sched_domain_shared *sd_share;
> +
> + if (!sched_feat(SCHED_CACHE) || env->idle == CPU_NEWLY_IDLE)
> + return;
> +
> + /* only care about sched domains spanning a LLC */
> + if (sd != rcu_dereference(per_cpu(sd_llc, env->dst_cpu)))
> + return;
> +
> + /*
> + * At this point we know this group spans a LLC domain.
> + * Record the statistic of this group in its corresponding
> + * shared LLC domain.
> + */
> + sd_share = rcu_dereference(per_cpu(sd_llc_shared,
> + cpumask_first(sched_group_span(group))));
Isn't this sd->shared ? Or did I loose the plot somewhere?
> + if (!sd_share)
> + return;
> +
> + if (READ_ONCE(sd_share->util_avg) != sgs->group_util)
> + WRITE_ONCE(sd_share->util_avg, sgs->group_util);
> +
> + if (unlikely(READ_ONCE(sd_share->capacity) != sgs->group_capacity))
> + WRITE_ONCE(sd_share->capacity, sgs->group_capacity);
> +}