Re: [PATCH 5/6] sched/fair: Consider the idle state of the whole core for load balance

From: Tim Chen
Date: Fri May 05 2023 - 18:51:41 EST


On Fri, 2023-05-05 at 15:23 +0200, Peter Zijlstra wrote:
> On Thu, May 04, 2023 at 09:09:55AM -0700, Tim Chen wrote:
>
> > @@ -10709,11 +10709,26 @@ static int should_we_balance(struct lb_env *env)
> > for_each_cpu_and(cpu, group_balance_mask(sg), env->cpus) {
> > if (!idle_cpu(cpu))
> > continue;
> > + else {
> > + /*
> > + * Don't balance to idle SMT in busy core right away when
> > + * balancing cores, but remember the first idle SMT CPU for
> > + * later consideration. Find CPU on an idle core first.
> > + */
> > + if (!(env->sd->flags & SD_SHARE_CPUCAPACITY) && !is_core_idle(cpu)) {
> > + if (idle_smt == -1)
> > + idle_smt = cpu;
> > + continue;
> > + }
> > + }
>
> Not only does that bust CodingStyle, it's also entirely daft. What
> exactly is the purpose of that else statement?
>
>

Yeah, that's a dumb "else" statement. Will remove that.

Tim