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

Commit 485a6189 authored by Junjie Wu's avatar Junjie Wu Committed by Gerrit - the friendly Code Review server
Browse files

cpufreq: interactive: Do not reschedule timer if policy->max changes



Current implementation rearms timer in CPUFREQ_GOV_LIMITS when
policy->max increases. That's because CPUs' timers are not rearmed if
previous frequency evaluation selects policy->max.

With commit 16b90977d0941f2cf623ea58f6bd01ff82c83b25
("cpufreq: interactive: Rearm governor timer at max freq"),
interactive governor timer is always rearmed, and thus timer will
always fire if CPU is busy. There is no need to rearm timer when
policy->max changes.

Remove code related to rearming timer for policy->max change in
CPUFREQ_GOV_LIMITS.

Change-Id: I9c2eb788ab3b1c4cf02fff653cb8919d52752cda
Signed-off-by: default avatarJunjie Wu <junjiew@codeaurora.org>
parent d837ea84
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ struct cpufreq_interactive_cpuinfo {
	spinlock_t target_freq_lock; /*protects target freq */
	unsigned int target_freq;
	unsigned int floor_freq;
	unsigned int max_freq;
	unsigned int min_freq;
	u64 floor_validate_time;
	u64 local_fvtime; /* per-cpu floor_validate_time */
@@ -1624,7 +1623,6 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
			pcpu->hispeed_validate_time =
				pcpu->floor_validate_time;
			pcpu->local_hvtime = pcpu->floor_validate_time;
			pcpu->max_freq = policy->max;
			pcpu->min_freq = policy->min;
			pcpu->reject_notification = true;
			down_write(&pcpu->enable_sem);
@@ -1681,26 +1679,8 @@ static int cpufreq_governor_interactive(struct cpufreq_policy *policy,
			pcpu->min_freq = policy->min;

			up_read(&pcpu->enable_sem);

			/* Reschedule timer only if policy->max is raised.
			 * Delete the timers, else the timer callback may
			 * return without re-arm the timer when failed
			 * acquire the semaphore. This race may cause timer
			 * stopped unexpectedly.
			 */

			if (policy->max > pcpu->max_freq) {
				pcpu->reject_notification = true;
				down_write(&pcpu->enable_sem);
				del_timer_sync(&pcpu->cpu_timer);
				del_timer_sync(&pcpu->cpu_slack_timer);
				cpufreq_interactive_timer_resched(j, false);
				up_write(&pcpu->enable_sem);
				pcpu->reject_notification = false;
		}

			pcpu->max_freq = policy->max;
		}
		break;
	}
	return 0;