Re: [PATCH] sched: fix spurious active migration
From: Vincent Guittot
Date: Wed Oct 01 2014 - 03:02:43 EST
On 30 September 2014 20:41, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> On Tue, Sep 30, 2014 at 10:41:08AM +0200, Vincent Guittot wrote:
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 2a1e6ac..adad532 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -6425,13 +6425,14 @@ static struct sched_group *find_busiest_group(struct lb_env *env)
>>
>> if (env->idle == CPU_IDLE) {
>> /*
>> - * This cpu is idle. If the busiest group load doesn't
>> - * have more tasks than the number of available cpu's and
>> - * there is no imbalance between this and busiest group
>> - * wrt to idle cpu's, it is balanced.
>> + * This cpu is idle. If the busiest group is not overloaded
>> + * and there is no imbalance between this and busiest group
>> + * wrt to idle cpus, it is balanced. The imbalance becomes
>> + * significant if the diff is greater than 1 otherwise we
>> + * might end up to just move the imbalance on another group
>> */
>> - if ((local->idle_cpus < busiest->idle_cpus) &&
>> - busiest->sum_nr_running <= busiest->group_weight)
>> + if ((local->idle_cpus <= (busiest->idle_cpus + 1)) &&
>
> So I'm thick and I don't get this one.. In fact I don't seem to
> understand the existing code either.
My understand of the original code is that if a group is overloaded
(wrt capacity_factor) but has less tasks than CPUs (so overloaded
because of rt) and the local group has more idle CPUs then it's worth
balancing tasks and load.
I have changed it into : if the busiest group is overloaded or the
local has more than 1 idle CPU than the busiest, it makes sense to try
to balance tasks in order to balance the avg_load of the groups. But
if the local group has only 1 more idle CPU than the busiest, it's
probably not possible to leverage the average load load of the groups.
We will only move the imbalance from 1 group to another one
>
> If we're idle, and busiest is overloaded, we want to have tasks. Why
> would we care about number of idle cpus etc..
>
>> + !(busiest->group_type == group_overloaded))
>
> Would not: busiest->group_type != group_overloaded, read more natural?
> Also, would it make sense to make this the first condition?
that's fair for both remark
>
>> goto out_balanced;
>> } else {
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/