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

Commit 16540cf2 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

cpufreq: schedutil: Fix the incorrect average capacity calculation



Don't go beyond the next window while calculating the cycles in
sugov_track_cycles(). Doing so results in calling sugov_track_cycles()
with backwards time stamp. The next window is updated after the
average capacity is calculated and subsequent calls to
sugov_track_cycles() update the cycles for the next window.

Change-Id: Ic2b1262113859e4e8d8c1f3d69bbe1a610ca92de
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 8f0f3b0c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -179,10 +179,12 @@ static void sugov_track_cycles(struct sugov_policy *sg_policy,
				u64 upto)
				u64 upto)
{
{
	u64 delta_ns, cycles;
	u64 delta_ns, cycles;
	u64 next_ws = sg_policy->last_ws + sched_ravg_window;


	if (use_pelt())
	if (use_pelt())
		return;
		return;


	upto = min(upto, next_ws);
	/* Track cycles in current window */
	/* Track cycles in current window */
	delta_ns = upto - sg_policy->last_cyc_update_time;
	delta_ns = upto - sg_policy->last_cyc_update_time;
	delta_ns *= prev_freq;
	delta_ns *= prev_freq;