Hello Leo,
On 12/19/2016 10:02 AM, Leo Yan wrote:
On Mon, Dec 19, 2016 at 08:27:15AM +0100, Vincent Guittot wrote:
[...]
No in Thara's path, sd->overutilized and rd->overutilized have the exact same meaning, it is just that we rely on the parent to share the over utilization with the other cpu at the same level and the rd->overutilized is used as the parent of the last sd level but there is no difference in the usage
I think sd->overutilized and rd->overutilized have different visibility for CPUs. Please see below example:
CPU A SD level 1 - SG1 (CPUA), SG2 (CPUB) SD level 2 - SG5(CPUA, CPUB), SG6(CPU C, CPU D) RD
CPU B SD level 1 - SG2(CPUB), SG1 (CPUA) SD level 2 - SG5(CPU A, CPU B), SG6(CPU C, CPUD) RD
CPU C SD level 1 - SG3(CPU C), SG4 (CPUD) SD level 2 - SG6(CPUC, CPUD), SG5(CPUA, CPU B) RD
CPU D SD level 1 - SG4(CPU D), SG3(CPU C) SD level2 - SG6(CPUC, CPU D), SG5(CPU A, APU B) RD
If CPUA set its sd->overutilized flag into SG5, then later CPUC check sd->overutilized CPUC will only check the flags in SG6. So CPUA set sd->overutilized flag and this flag can be observed by CPUB, but CPUC cannot observe it.
Yes you are correct. The intend here is to allow CPU A and CPU B to sort out the imbalance by themselves before involving CPU C. The update_sd_lb already takes care of setting this flag in RD if the imbalance cannot be sorted out inside SG5.
+ /* If the domain util is greater that domain capacity, load balancing + * needs to be done at the next sched domain level as well + */ + if (sds->total_capacity * 1024 < sds->total_util * capacity_margin) { + /* If already at the highest domain nothing can be done */ + if (env->sd->parent) + set_sd_overutilized(env->sd->parent, + env->dst_rq->rd);
But what is missing is handling of misfit task. Can we not handle misfit task as a separate condition in update_sd_lb? i.e in the above example if either CPU A or CPU B has a misfit task, set the overutilization flag for the next level SD which is equivalent to setting the flag in RD in this case.
Regards Thara
But for rd->overutilized flag, it is visible to all CPUs. This is why I think function is_sd_overutilized() should change as below, CPUC iterates all "sd->overutilized" flags in the same schedule domain and finally find SG5's "overutilized" flag is set CPUA.
static bool is_sd_overutilized(struct sched_domain *sd) { struct sched_group *group = sd->groups; int cpu = smp_processor_id();
if (cpu_rq(cpu)->rd->overutilized) return true; do { if (group->overutilized) return true; } while (group = group->next, group != sd->groups); return false;
}
Thanks, Leo Yan
-- Regards Thara