cpufreq: acpi-cpufreq: use cached frequency mapping when possible
authorSteve Muckle <steve.muckle@linaro.org>
Wed, 13 Jul 2016 20:25:27 +0000 (13:25 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 21 Jul 2016 20:28:32 +0000 (22:28 +0200)
A call to cpufreq_driver_resolve_freq will cache the mapping from
the desired target frequency to the frequency table index. If there
is a mapping for the desired target frequency then use it instead of
looking up the mapping again.

Signed-off-by: Steve Muckle <smuckle@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/acpi-cpufreq.c

index 11c9a078e0fdd166aa3fa44fc4887176e624c03a..297e9128fe9fe11948352f16984a3a85e5e0cdb5 100644 (file)
@@ -473,7 +473,10 @@ unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy,
        /*
         * Find the closest frequency above target_freq.
         */
-       index = cpufreq_table_find_index_dl(policy, target_freq);
+       if (policy->cached_target_freq == target_freq)
+               index = policy->cached_resolved_idx;
+       else
+               index = cpufreq_table_find_index_dl(policy, target_freq);
 
        entry = &policy->freq_table[index];
        next_freq = entry->frequency;