Skip to content

Commit

Permalink
sched/fair: Use utilization to select misfit task
Browse files Browse the repository at this point in the history
Utilization is used to detect a misfit task but the load is then used to
select the task on the CPU which can lead to select a small task with
high weight instead of the task that triggered the misfit migration.

Check that task can't fit the CPU's capacity when selecting the misfit
task instead of using the load.

Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org>
Acked-by: Valentin Schneider <valentin.schneider@arm.com>
Cc: Ben Segall <bsegall@google.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Juri Lelli <juri.lelli@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Morten.Rasmussen@arm.com
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: hdanton@sina.com
Cc: parth@linux.ibm.com
Cc: pauld@redhat.com
Cc: quentin.perret@arm.com
Cc: riel@surriel.com
Cc: srikar@linux.vnet.ibm.com
Link: https://lkml.kernel.org/r/1571405198-27570-9-git-send-email-vincent.guittot@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Vincent Guittot authored and Ingo Molnar committed Oct 21, 2019
1 parent 2ab4092 commit c63be7b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -7408,13 +7408,8 @@ static int detach_tasks(struct lb_env *env)
break;

case migrate_misfit:
load = task_h_load(p);

/*
* Load of misfit task might decrease a bit since it has
* been recorded. Be conservative in the condition.
*/
if (load/2 < env->imbalance)
/* This is not a misfit task */
if (task_fits_capacity(p, capacity_of(env->src_cpu)))
goto next;

env->imbalance = 0;
Expand Down Expand Up @@ -8358,7 +8353,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
if (busiest->group_type == group_misfit_task) {
/* Set imbalance to allow misfit tasks to be balanced. */
env->migration_type = migrate_misfit;
env->imbalance = busiest->group_misfit_task_load;
env->imbalance = 1;
return;
}

Expand Down

0 comments on commit c63be7b

Please sign in to comment.