Re: [PATCH v2 1/4] sched/fair: Optimize checking for group_asym_packing

From: Peter Zijlstra
Date: Mon May 03 2021 - 05:25:29 EST


On Tue, Apr 13, 2021 at 07:04:33PM -0700, Ricardo Neri wrote:
> By checking local_group, we can avoid additional checks and invoking
> sched_asmy_prefer() when it is not needed.

This really could do with a few words on *why* that is correct. ISTR
thinking this made sense when I last looked at it, but today, after
having the brain reset by not looking at a computer for 4 days its not
immediate obvious anymore.

> Signed-off-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
> ---
> kernel/sched/fair.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 04a3ce20da67..4ef3fa0d5e8d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8455,7 +8455,7 @@ static inline void update_sg_lb_stats(struct lb_env *env,
> }
>
> /* Check if dst CPU is idle and preferred to this group */
> - if (env->sd->flags & SD_ASYM_PACKING &&
> + if (!local_group && env->sd->flags & SD_ASYM_PACKING &&
> env->idle != CPU_NOT_IDLE &&
> sgs->sum_h_nr_running &&
> sched_asym_prefer(env->dst_cpu, group->asym_prefer_cpu)) {
> --
> 2.17.1
>