Re: [PATCH v2] sched/cache: Avoid publishing partial LLC utilization

From: Chen Yu

Date: Wed Oct 14 2026 - 11:35:29 EST


On Tue, Oct 13, 2026 at 04:43:38PM +0800, Jemmy Wong wrote:
> Date: Tue, 13 Oct 2026 16:43:38 +0800
> From: Jemmy Wong <jemmywong512@xxxxxxxxx>
> To: mingo@xxxxxxxxxx, peterz@xxxxxxxxxxxxx, tim.c.chen@xxxxxxxxxxxxxxx,
> kprateek.nayak@xxxxxxx, yu.c.chen@xxxxxxxxx
> Cc: juri.lelli@xxxxxxxxxx, vincent.guittot@xxxxxxxxxx,
> dietmar.eggemann@xxxxxxx, rostedt@xxxxxxxxxxx, bsegall@xxxxxxxxxx,
> mgorman@xxxxxxx, vschneid@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, Jemmy
> Wong <jemmywong512@xxxxxxxxx>
> Subject: [PATCH v2] sched/cache: Avoid publishing partial LLC utilization
> X-Mailer: git-send-email 2.54.0
>
> Skip publication on affinity retries using LBF_ALL_PINNED, retaining
> the first-pass snapshots and avoiding repeated cpumask checks. On the

[ ... ]

> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 57360f5cdde4..dc01fdc0526d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -12111,6 +12111,14 @@ static void record_sg_llc_stats(struct lb_env *env,
> if (env->sd->child != rcu_dereference_all(per_cpu(sd_llc, env->dst_cpu)))
> return;
>
> + /*
> + * A redo repeats stats published on the first pass. Hotplug can

It took me a while to understand the check of LBF_ALL_PINNED, to make it clear
how about adding comment below for future reference:

Once we enter record_sg_llc_stats(), LBF_ALL_PINNED being set is a
necessary and sufficient condition for being in a redo. Since
env->cpus may be incomplete when LBF_ALL_PINNED is set, and to avoid
recomputing the statistics of the same group during a redo, we skip
this update. The impact of skipping is small, because the interval
between the first pass and the subsequent redo is short.

Otherwise it looks good to me and

Reviewed-by: Chen Yu <yu.c.chen@xxxxxxxxx>

thanks,
Chenyu