From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751431AbcFATqZ (ORCPT ); Wed, 1 Jun 2016 15:46:25 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:36840 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750863AbcFATqX (ORCPT ); Wed, 1 Jun 2016 15:46:23 -0400 From: Steve Muckle X-Google-Original-From: Steve Muckle Date: Wed, 1 Jun 2016 12:46:15 -0700 To: Viresh Kumar Cc: Rafael Wysocki , linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar Subject: Re: [PATCH V2 2/2] cpufreq: Optimize cpufreq_frequency_table_target() Message-ID: <20160601194615.GQ9864@graphite.smuckle.net> References: <120ed8a873b6df2ccc9406eeec8f8f74e5f9b0d5.1464777376.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <120ed8a873b6df2ccc9406eeec8f8f74e5f9b0d5.1464777376.git.viresh.kumar@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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...