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

Commit e7347694 authored by Viresh Kumar's avatar Viresh Kumar Committed by Rafael J. Wysocki
Browse files

cpufreq: stats: don't update stats on false notifiers



We need to call cpufreq_stats_update() to update 'time_in_state' for the last
frequency. This is achieved by calling it from cpufreq_stat_notifier_trans(),
which is called after frequency transition.

But if we detect that the cpu's frequency haven't really changed and its a false
POSTCHANGE notification, we don't really need to update time_in_state.

It wouldn't cause any harm in calling cpufreq_stats_update() but we can avoid
calling it here and call it when the frequency really changes. The result will
be the same but more efficient.

Reviewed-by: default avatarPrarit Bhargava <prarit@redhat.com>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 9225913d
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -289,11 +289,11 @@ static int cpufreq_stat_notifier_trans(struct notifier_block *nb,
	if (old_index == -1 || new_index == -1)
	if (old_index == -1 || new_index == -1)
		goto put_policy;
		goto put_policy;


	cpufreq_stats_update(stats);

	if (old_index == new_index)
	if (old_index == new_index)
		goto put_policy;
		goto put_policy;


	cpufreq_stats_update(stats);

	spin_lock(&cpufreq_stats_lock);
	spin_lock(&cpufreq_stats_lock);
	stats->last_index = new_index;
	stats->last_index = new_index;
#ifdef CONFIG_CPU_FREQ_STAT_DETAILS
#ifdef CONFIG_CPU_FREQ_STAT_DETAILS