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

Commit 84c88fc3 authored by Chris Redpath's avatar Chris Redpath
Browse files

ANDROID: Combined EAS Load Balance Tweaks

Contains:

ANDROID: sched/fair: Reduce balance interval to 1 jiffy if we have a misfit task

It is quite a common occurrence that we have a misfit task (a task
running on a CPU which is close to the capacity limit of that CPU)
in the system AND we have recently done a load balance operation.
Normal load-balance rate limiting means we can leave those tasks on
the restrictive CPU for a few hundred ms before we move them.

Inspired by the work Leo Yan did on balancing misfits.

This patch reduces the balance interval to one jiffy when there are such
tasks running.

There appears to be no impact on interactive performance from this
patch.

ANDROID: sched/fair: kick nohz idle balance for misfit task

If there have misfit task on one CPU, current code does not handle this
situation for nohz idle balance. As result, we can see the misfit task
stays run on little core for long time.

So this patch check if the CPU has misfit task or not. If has misfit
task then kick nohz idle balance so finally can execute active balance.

Change-Id: I117d3b7404296f8de11cb960a87a6b9a54a9f348
Signed-off-by: Leo Yan <leo.yan at linaro.org>
[taken from https://lists.linaro.org/pipermail/eas-dev/2016-September/000551.html

]
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
Signed-off-by: default avatarPatrick Bellasi <patrick.bellasi@arm.com>

ANDROID: sched: EAS: kill incorrect nohz idle cpu kick

EAS won't allow NOHZ idle balancer until CPU's over utilized.  However
nohz_kick_needed() can return true.  This causes idle CPU wake up for
nothing.

Change-Id: I6e548442e29e4f85cda695e4c7101dd591b12fe6
Signed-off-by: default avatarJoonwoo Park <joonwoop@codeaurora.org>
(merge conflicts)
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>

Change-Id: I71d74734d3bd6bca80476c0f466ba48914b7ac02
Signed-off-by: default avatarChris Redpath <chris.redpath@arm.com>
parent 60664914
Loading
Loading
Loading
Loading
+23 −0
Original line number Original line Diff line number Diff line
@@ -9542,6 +9542,7 @@ static inline unsigned long
get_sd_balance_interval(struct sched_domain *sd, int cpu_busy)
get_sd_balance_interval(struct sched_domain *sd, int cpu_busy)
{
{
	unsigned long interval = sd->balance_interval;
	unsigned long interval = sd->balance_interval;
	unsigned int cpu;


	if (cpu_busy)
	if (cpu_busy)
		interval *= sd->busy_factor;
		interval *= sd->busy_factor;
@@ -9550,6 +9551,24 @@ get_sd_balance_interval(struct sched_domain *sd, int cpu_busy)
	interval = msecs_to_jiffies(interval);
	interval = msecs_to_jiffies(interval);
	interval = clamp(interval, 1UL, max_load_balance_interval);
	interval = clamp(interval, 1UL, max_load_balance_interval);


	/*
	 * check if sched domain is marked as overutilized
	 * we ought to only do this on systems which have SD_ASYMCAPACITY
	 * but we want to do it for all sched domains in those systems
	 * So for now, just check if overutilized as a proxy.
	 */
	/*
	 * If we are overutilized and we have a misfit task, then
	 * we want to balance as soon as practically possible, so
	 * we return an interval of zero.
	 */
	if (energy_aware() && sd_overutilized(sd)) {
		/* we know the root is overutilized, let's check for a misfit task */
		for_each_cpu(cpu, sched_domain_span(sd)) {
			if (rq_has_misfit(cpu_rq(cpu)))
				return 1;
		}
	}
	return interval;
	return interval;
}
}


@@ -10168,6 +10187,10 @@ static inline bool nohz_kick_needed(struct rq *rq, bool only_update)
	    (!energy_aware() || cpu_overutilized(cpu)))
	    (!energy_aware() || cpu_overutilized(cpu)))
		return true;
		return true;


	/* Do idle load balance if there have misfit task */
	if (energy_aware())
		return rq_has_misfit(rq);

	rcu_read_lock();
	rcu_read_lock();
	sds = rcu_dereference(per_cpu(sd_llc_shared, cpu));
	sds = rcu_dereference(per_cpu(sd_llc_shared, cpu));
	if (sds && !energy_aware()) {
	if (sds && !energy_aware()) {