From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933182AbcFBS2o (ORCPT ); Thu, 2 Jun 2016 14:28:44 -0400 Received: from mail-pf0-f171.google.com ([209.85.192.171]:34167 "EHLO mail-pf0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753605AbcFBS2j (ORCPT ); Thu, 2 Jun 2016 14:28:39 -0400 From: Steve Muckle X-Google-Original-From: Steve Muckle Date: Thu, 2 Jun 2016 11:28:35 -0700 To: Viresh Kumar Cc: Steve Muckle , 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: <20160602182835.GC14579@graphite.smuckle.net> References: <120ed8a873b6df2ccc9406eeec8f8f74e5f9b0d5.1464777376.git.viresh.kumar@linaro.org> <20160601194615.GQ9864@graphite.smuckle.net> <20160602012904.GV3725@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20160602012904.GV3725@vireshk-i7> 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 Thu, Jun 02, 2016 at 06:59:04AM +0530, Viresh Kumar wrote: > On 01-06-16, 12:46, Steve Muckle wrote: > > > /* > > > * 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... > > I understand that, but I am not sure how far should we go to avoid > that. Open coding routines to save on that isn't a good idea surely. > > I have at least kept this routine in cpufreq.h to avoid a call, but > eventually we will have at least a call somewhere within it. :( Shouldn't we be able to avoid extra function calls through the use of macros/inlines? Otherwise this is making things slower for schedutil than it is today. Actually cpufreq_driver_resolve_freq() shouldn't require any calls from schedutil when a freq_table is available - the whole thing could be run inline.