Re: [Patch v2 1/6] sched/fair: Determine active load balance for SMT sched groups

From: Peter Zijlstra
Date: Mon Jun 12 2023 - 16:15:07 EST


On Mon, Jun 12, 2023 at 01:12:10PM -0700, Tim Chen wrote:
> How about making this modification to take care of SMT-4 case?
>

Yep, that works.

>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 33246dce10db..e2261c24e536 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9642,11 +9642,11 @@ static bool update_sd_pick_busiest(struct lb_env *env,
> case group_has_spare:
> /*
> * Do not pick sg with SMT CPUs over sg with pure CPUs,
> - * as we do not want to pull task off half empty SMT core
> + * as we do not want to pull task off SMT core with one task
> * and make the core idle.
> */
> if (smt_vs_nonsmt_groups(sds->busiest, sg)) {
> - if (sg->flags & SD_SHARE_CPUCAPACITY)
> + if (sg->flags & SD_SHARE_CPUCAPACITY && sgs->sum_h_nr_running <= 1)
> return false;
> else
> return true;
>
>