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

Commit e39358b6 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti Committed by Lingutla Chandrasekhar
Browse files

sched/fair: Improve the scheduler



This change is for general scheduler improvement.

Change-Id: Ice00d43c70be105b5bc3ad09caa6047aa98d7402
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
[clingutla@codeaurora.org: Resolved trivial merge conflicts.]
Signed-off-by: default avatarLingutla Chandrasekhar <clingutla@codeaurora.org>
parent 916e703d
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -10357,6 +10357,27 @@ update_next_balance(struct sched_domain *sd, unsigned long *next_balance)
		*next_balance = next;
}

#ifdef CONFIG_SCHED_WALT
static inline bool min_cap_cluster_has_misfit_task(void)
{
	int cpu;

	for_each_possible_cpu(cpu) {
		if (!is_min_capacity_cpu(cpu))
			break;
		if (cpu_rq(cpu)->walt_stats.nr_big_tasks)
			return true;
	}

	return false;
}
#else
static inline bool min_cap_cluster_has_misfit_task(void)
{
	return false;
}
#endif

/*
 * idle_balance is called by schedule() if this_cpu is about to become
 * idle. Attempts to pull tasks from other CPUs.
@@ -10368,17 +10389,25 @@ static int idle_balance(struct rq *this_rq)
	struct sched_domain *sd;
	int pulled_task = 0;
	u64 curr_cost = 0;
	bool force_lb = false;

	if (cpu_isolated(this_cpu))
		return 0;

	/*
	 * Force higher capacity CPUs doing load balance, when the lower
	 * capacity CPUs has some misfit tasks.
	 */
	if (!is_min_capacity_cpu(this_cpu) && min_cap_cluster_has_misfit_task())
		force_lb = true;

	/*
	 * We must set idle_stamp _before_ calling idle_balance(), such that we
	 * measure the duration of idle_balance() as idle time.
	 */
	this_rq->idle_stamp = rq_clock(this_rq);

	if (!energy_aware() &&
	if (!energy_aware() && !force_lb &&
	    (this_rq->avg_idle < sysctl_sched_migration_cost ||
	     !this_rq->rd->overload)) {
		rcu_read_lock();
@@ -10401,7 +10430,8 @@ static int idle_balance(struct rq *this_rq)
		if (!(sd->flags & SD_LOAD_BALANCE))
			continue;

		if (this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
		if (!force_lb &&
		    this_rq->avg_idle < curr_cost + sd->max_newidle_lb_cost) {
			update_next_balance(sd, &next_balance);
			break;
		}