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

Commit 7070a9e2 authored by Saravana Kannan's avatar Saravana Kannan
Browse files

cpufreq: schedutil: Avoid unnecessary kthread wakeup



We consider the util data for a CPU to be stale if it is older than one
WALT window duration.

However, when the CPUs in a cluster have their util data updated at the end
of a WALT window, some of the active CPUs might get their update a tiny bit
after the end of the WALT window and hence have their util data ignored
when selecting the cluster frequency.

This can momentarily (for a few micro seconds) cause the cluster frequency
to drop to a lower frequency and then come back to the correct frequency.
This momentary drop and the immediate increase in the cluster frequency
causes an unnecessary wake up of the governor's kthread.

This patch avoids this unnecessary wake up by considering the util data for
a CPU to be stale only if it's older than 112% of the WALT window duration.

Change-Id: I931204dad90eb086abb3f684b3a249d60d3c7001
Signed-off-by: default avatarSaravana Kannan <skannan@codeaurora.org>
parent 6b418383
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ struct sugov_cpu {
};

static DEFINE_PER_CPU(struct sugov_cpu, sugov_cpu);
static unsigned int stale_ns;

/************************ Governor internals ***********************/

@@ -346,7 +347,7 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu,
		 * idle now (and clear iowait_boost for it).
		 */
		delta_ns = last_freq_update_time - j_sg_cpu->last_update;
		if (delta_ns > sched_ravg_window) {
		if (delta_ns > stale_ns) {
			j_sg_cpu->iowait_boost = 0;
			continue;
		}
@@ -694,6 +695,7 @@ static int sugov_init(struct cpufreq_policy *policy)

	policy->governor_data = sg_policy;
	sg_policy->tunables = tunables;
	stale_ns = sched_ravg_window + (sched_ravg_window >> 3);

	ret = kobject_init_and_add(&tunables->attr_set.kobj, &sugov_tunables_ktype,
				   get_governor_parent_kobj(policy), "%s",