Re: [PATCH] sched/fair: Return the busiest group only if imbalance is meaningful
From: Dietmar Eggemann
Date: Wed Apr 06 2022 - 15:56:57 EST
On 06/04/2022 17:33, Vincent Guittot wrote:
> On Wed, 6 Apr 2022 at 17:07, 彭志刚 <zgpeng.linux@xxxxxxxxx> wrote:
[...]
> I think that this case should be covered by an additional test in
> calculate_imbalance because we should not try to pull load in groupA
> if it's already above the average load. Something like below should
> cover this
>
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9469,6 +9469,16 @@ static inline void calculate_imbalance(struct
> lb_env *env, struct sd_lb_stats *s
>
> sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
> sds->total_capacity;
> +
> + /*
> + * Don't pull any tasks if this group is already above the
> + * domain average load.
> + */
> + if (local->avg_load >= sds->avg_load) {
> + env->imbalance = 0;
> + return;
> + }
> +
LGTM. Like for the `local->group_type == group_overloaded` case in
find_busiest_group() where we force `goto out_balanced`.
[...]