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

Commit 72947a6f authored by Syed Rameez Mustafa's avatar Syed Rameez Mustafa Committed by Matt Wagantall
Browse files

sched: actively migrate tasks to idle big CPUs during sched boost



The sched boost feature is currently tick driven, i.e. task placement
decisions only take place at a tick (or wakeup). The load balancer
does not have any knowledge of boost being in effect. Tasks that are
woken up on a little CPU when all big CPUs are busy will continue
executing there at least until the next tick even if one of the big
CPUs becomes idle. Reduce this latency by adding support for detecting
whether boost is in effect or not in the load balancer.  If boost is
in effect any big CPU running idle balance will trigger active
migration from a little CPU with the highest task load.

Change-Id: Ib2828809efa0f9857f5009b29931f63b276a59f3
Signed-off-by: default avatarSyed Rameez Mustafa <rameezmustafa@codeaurora.org>
parent 1cb8a6f4
Loading
Loading
Loading
Loading
+20 −3
Original line number Diff line number Diff line
@@ -3275,6 +3275,11 @@ static inline int mostly_idle_cpu(int cpu)
	return 0;
}

static inline int sched_boost(void)
{
	return 0;
}

static inline int is_small_task(struct task_struct *p)
{
	return 0;
@@ -6268,6 +6273,7 @@ enum fbq_type { regular, remote, all };
#define LBF_SOME_PINNED	0x08
#define LBF_IGNORE_SMALL_TASKS 0x10
#define LBF_PWR_ACTIVE_BALANCE 0x20
#define LBF_SCHED_BOOST 0x40

struct lb_env {
	struct sched_domain	*sd;
@@ -7302,6 +7308,13 @@ static bool update_sd_pick_busiest(struct lb_env *env,
{
	struct sg_lb_stats *busiest = &sds->busiest_stat;

	if (sched_boost() && !sds->busiest && sgs->sum_nr_running &&
		(env->idle != CPU_NOT_IDLE) && (capacity(env->dst_rq) >
		group_rq_capacity(sg))) {
		env->flags |= LBF_SCHED_BOOST;
		return true;
	}

	if (sgs->group_type > busiest->group_type)
		return true;

@@ -7671,6 +7684,10 @@ static struct sched_group *find_busiest_group(struct lb_env *env)
	if (!sds.busiest || busiest->sum_nr_running == 0)
		goto out_balanced;

	if (sched_boost() && (capacity(env->dst_rq) >
				group_rq_capacity(sds.busiest)))
		goto force_balance;

	if (bail_inter_cluster_balance(env, &sds))
		goto out_balanced;

@@ -7855,7 +7872,7 @@ static int need_active_balance(struct lb_env *env)
{
	struct sched_domain *sd = env->sd;

	if (env->flags & LBF_PWR_ACTIVE_BALANCE)
	if (env->flags & (LBF_PWR_ACTIVE_BALANCE | LBF_SCHED_BOOST))
		return 1;

	if (env->idle == CPU_NEWLY_IDLE) {
@@ -8074,7 +8091,7 @@ more_balance:
	}

	if (!ld_moved) {
		if (!(env.flags & LBF_PWR_ACTIVE_BALANCE))
		if (!(env.flags & (LBF_PWR_ACTIVE_BALANCE | LBF_SCHED_BOOST)))
			schedstat_inc(sd, lb_failed[idle]);

		/*
@@ -8084,7 +8101,7 @@ more_balance:
		 * excessive cache_hot migrations and active balances.
		 */
		if (idle != CPU_NEWLY_IDLE &&
		    !(env.flags & LBF_PWR_ACTIVE_BALANCE))
		    !(env.flags & (LBF_PWR_ACTIVE_BALANCE | LBF_SCHED_BOOST)))
			sd->nr_balance_failed++;

		if (need_active_balance(&env)) {