sched/fair: Don't allow boosted tasks to be migrated to small cores

We want boosted tasks to run on big cores. But CAF's load balancer
changes do not account for SchedTune boosting, so this allows for
boosted tasks to be migrated to a suboptimal core. Let's mitigate
this by setting the LBF_IGNORE_STUNE_BOOSTED_TASKS for tasks
migrating from a larger capacity core to a min capacity one and
that have a schedtune boost > 10. If both are true, do
not migrate this task. If the next time the load balancer runs,
the same task is selected, we clear the
LBF_IGNORE_STUNE_BOOSTED_TASKS flag.

Change-Id: Ibd9f6616b482d446d5acce2a93418bfda4c35ffb
Signed-off-by: Zachariah Kennedy <zkennedy87@gmail.com>
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Zachariah Kennedy 2019-11-14 18:54:26 +00:00 committed by Richard Raya
parent 2ef5980a4d
commit d5afaaf78f

View File

@ -9170,6 +9170,7 @@ enum group_type {
#define LBF_SOME_PINNED 0x08
#define LBF_IGNORE_BIG_TASKS 0x100
#define LBF_IGNORE_PREFERRED_CLUSTER_TASKS 0x200
#define LBF_IGNORE_STUNE_BOOSTED_TASKS 0x400
struct lb_env {
struct sched_domain *sd;
@ -9369,6 +9370,11 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env)
!task_fits_max(p, env->dst_cpu))
return 0;
/* Don't allow boosted tasks to be pulled to small cores */
if (env->flags & LBF_IGNORE_STUNE_BOOSTED_TASKS &&
(schedtune_task_boost(p) > 10))
return 0;
if (task_running(env->src_rq, p)) {
schedstat_inc(p->se.statistics.nr_failed_migrations_running);
return 0;
@ -9490,6 +9496,9 @@ static int detach_tasks(struct lb_env *env)
if (cpu_capacity(env->dst_cpu) < cpu_capacity(env->src_cpu))
env->flags |= LBF_IGNORE_BIG_TASKS;
if (is_min_capacity_cpu(env->dst_cpu) && !is_min_capacity_cpu(env->src_cpu))
env->flags |= LBF_IGNORE_STUNE_BOOSTED_TASKS;
redo:
while (!list_empty(tasks)) {
/*
@ -9574,10 +9583,12 @@ next:
}
if (env->flags & (LBF_IGNORE_BIG_TASKS |
LBF_IGNORE_PREFERRED_CLUSTER_TASKS) && !detached) {
LBF_IGNORE_PREFERRED_CLUSTER_TASKS |
LBF_IGNORE_STUNE_BOOSTED_TASKS) && !detached) {
tasks = &env->src_rq->cfs_tasks;
env->flags &= ~(LBF_IGNORE_BIG_TASKS |
LBF_IGNORE_PREFERRED_CLUSTER_TASKS);
LBF_IGNORE_PREFERRED_CLUSTER_TASKS |
LBF_IGNORE_STUNE_BOOSTED_TASKS);
env->loop = orig_loop;
goto redo;
}