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

From: Peter Zijlstra
Date: Mon Jul 17 2023 - 09:38:10 EST


On Mon, Jul 17, 2023 at 05:48:02PM +0530, Shrikanth Hegde wrote:

> Hi Peter.
>
> Sending on behalf of tim. I have included my suggestion as well. Hope
> that's ok. Please find below the patch as of now. it includes the
> couple of changes that are discussed. (in 1/6 and in 3/6)

Could you please add a Changelog and SoB thingies such that I can apply
the thing?

Given Tim is on holidays, perhaps do something like:

Originally-by: Tim Chen <...>

After all, you did some changes and verified it actually works etc..


> ---
> kernel/sched/fair.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 932e7b78894a..9502013abe33 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9532,7 +9532,7 @@ static inline long sibling_imbalance(struct lb_env *env,
> imbalance /= ncores_local + ncores_busiest;
>
> /* Take advantage of resource in an empty sched group */
> - if (imbalance == 0 && local->sum_nr_running == 0 &&
> + if (imbalance <= 1 && local->sum_nr_running == 0 &&
> busiest->sum_nr_running > 1)
> imbalance = 2;
>
> @@ -9720,6 +9720,17 @@ static bool update_sd_pick_busiest(struct lb_env *env,
> break;
>
> case group_smt_balance:
> + /* no idle cpus on both groups handled by group_fully_busy below */
> + if (sgs->idle_cpus != 0 || busiest->idle_cpus != 0) {
> + if (sgs->idle_cpus > busiest->idle_cpus)
> + return false;
> + if (sgs->idle_cpus < busiest->idle_cpus)
> + return true;
> + if (sgs->sum_nr_running <= busiest->sum_nr_running)
> + return false;
> + }
> + break;
> +
> case group_fully_busy:
> /*
> * Select the fully busy group with highest avg_load. In
> --
> 2.31.1