Messages in this thread | | | From | Steve Muckle <> | Date | Wed, 1 Jun 2016 12:46:15 -0700 | Subject | Re: [PATCH V2 2/2] cpufreq: Optimize cpufreq_frequency_table_target() |
| |
On Wed, Jun 01, 2016 at 04:09:55PM +0530, Viresh Kumar wrote: > cpufreq core keeps another table of sorted frequencies now and that can > be used to find a match quickly, instead of traversing the unsorted list > in an inefficient way. > > Create helper routines for separate relation types to optimize it > further. > > Ideally the new routine cpufreq_find_target_index() is required to be > exported, but s3c24xx was abusing the earlier API and have to be > supported for now. Added a FIXME for it. > > Tested on Exynos board with both ondemand and schedutil governor and > confirmed with help of various print messages that we are eventually > switching to the desired frequency based on a target frequency. > > Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> > --- > drivers/cpufreq/acpi-cpufreq.c | 15 ++-- > drivers/cpufreq/freq_table.c | 180 ++++++++++++++++++++++---------------- > drivers/cpufreq/s3c24xx-cpufreq.c | 13 ++- > include/linux/cpufreq.h | 20 ++++- > 4 files changed, 134 insertions(+), 94 deletions(-) > > diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c > index 32a15052f363..4f9f7504a17c 100644 > --- a/drivers/cpufreq/acpi-cpufreq.c > +++ b/drivers/cpufreq/acpi-cpufreq.c > @@ -468,20 +468,15 @@ unsigned int acpi_cpufreq_fast_switch(struct cpufreq_policy *policy, > struct acpi_cpufreq_data *data = policy->driver_data; > struct acpi_processor_performance *perf; > struct cpufreq_frequency_table *entry; > - unsigned int next_perf_state, next_freq, freq; > + unsigned int next_perf_state, next_freq, index; > > /* > * Find the closest frequency above target_freq. > - * > - * The table is sorted in the reverse order with respect to the > - * frequency and all of the entries are valid (see the initialization). > */ > - entry = policy->freq_table; > - do { > - entry++; > - freq = entry->frequency; > - } while (freq >= target_freq && freq != CPUFREQ_TABLE_END); > - entry--; > + index = cpufreq_frequency_table_target(policy, target_freq, > + CPUFREQ_RELATION_L);
This adds a function call to the fast path...
| |