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

Commit ccaa1d0e authored by Jonathan Avila's avatar Jonathan Avila Committed by Jonathan Avila
Browse files

cpufreq: schedutil: Avoid WALT logic when WALT sysctl flag not set



When sysctl_sched_use_walt_cpu_util is set to 0, WALT stats are no longer
updated.  As a result, the schedutil governor throws excessive warnings.
Fix this by not running any WALT-related logic when
sysctl_sched_use_walt_cpu_util is 0.

Change-Id: Ibdbc5243c6f3d11071f8ab715ca76e0e840f8090
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent 69361514
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@

#include <linux/sched/cpufreq.h>
#include <trace/events/power.h>
#include <linux/sched/sysctl.h>

struct sugov_tunables {
	struct gov_attr_set	attr_set;
@@ -178,6 +179,10 @@ static void sugov_track_cycles(struct sugov_policy *sg_policy,
				u64 upto)
{
	u64 delta_ns, cycles;

	if (unlikely(!sysctl_sched_use_walt_cpu_util))
		return;

	/* Track cycles in current window */
	delta_ns = upto - sg_policy->last_cyc_update_time;
	cycles = (prev_freq * delta_ns) / (NSEC_PER_SEC / KHZ);
@@ -191,6 +196,9 @@ static void sugov_calc_avg_cap(struct sugov_policy *sg_policy, u64 curr_ws,
	u64 last_ws = sg_policy->last_ws;
	unsigned int avg_freq;

	if (unlikely(!sysctl_sched_use_walt_cpu_util))
		return;

	WARN_ON(curr_ws < last_ws);
	if (curr_ws <= last_ws)
		return;
@@ -561,6 +569,9 @@ static void sugov_walt_adjust(struct sugov_cpu *sg_cpu, unsigned long *util,
	unsigned long cpu_util = sg_cpu->util;
	bool is_hiload;

	if (unlikely(!sysctl_sched_use_walt_cpu_util))
		return;

	is_hiload = (cpu_util >= mult_frac(sg_policy->avg_cap,
					   sg_policy->tunables->hispeed_load,
					   100));