Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5234031 authored by Dietmar Eggemann's avatar Dietmar Eggemann Committed by Chris Redpath
Browse files

ANDROID: sched: Enable idle balance to pull single task towards cpu with higher capacity



We do not want to miss out on the ability to pull a single remaining
task from a potential source cpu towards an idle destination cpu. Add an
extra criteria to need_active_balance() to kick off active load balance
if the source cpu is over-utilized and has lower capacity than the
destination cpu.

cc: Ingo Molnar <mingo@redhat.com>
cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: default avatarMorten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: default avatarDietmar Eggemann <dietmar.eggemann@arm.com>
Change-Id: Ifa66a30d53c17d339fc5058901a87a643ffc3704
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent ac3ecee6
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -5925,6 +5925,11 @@ static int wake_cap(struct task_struct *p, int cpu, int prev_cpu)
	return min_cap * 1024 < task_util(p) * capacity_margin;
}

static bool cpu_overutilized(int cpu)
{
	return (capacity_of(cpu) * 1024) < (cpu_util(cpu) * capacity_margin);
}

/*
 * select_task_rq_fair: Select target runqueue for the waking task in domains
 * that have the 'sd_flag' flag set. In practice, this is SD_BALANCE_WAKE,
@@ -8036,6 +8041,13 @@ static int need_active_balance(struct lb_env *env)
			return 1;
	}

	if ((capacity_of(env->src_cpu) < capacity_of(env->dst_cpu)) &&
				env->src_rq->cfs.h_nr_running == 1 &&
				cpu_overutilized(env->src_cpu) &&
				!cpu_overutilized(env->dst_cpu)) {
			return 1;
	}

	return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2);
}