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

Commit 396bbefb authored by Jonathan Avila's avatar Jonathan Avila Committed by Gerrit - the friendly Code Review server
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 warnings which lead to
a crash. Fix this by not running any WALT-related logic when
sysctl_sched_use_walt_cpu_util is 0.

Change-Id: Ibdbc5243c6f3d11071f8ab715ca76e0e840f8090
CRs-Fixed: 2089058
Signed-off-by: default avatarJonathan Avila <avilaj@codeaurora.org>
parent 452becbf
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@
#include <uapi/linux/sched/types.h>
#include <linux/slab.h>
#include <trace/events/power.h>

#include <linux/sched/sysctl.h>
#include "sched.h"

#define SUGOV_KTHREAD_PRIORITY	50
@@ -147,6 +147,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);
@@ -160,6 +164,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;
@@ -339,6 +346,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));