lkml.org 
[lkml]   [2015]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] cpufreq: pass policy to ->get() driver callback
Date
On Friday, July 31, 2015 04:14:33 PM Viresh Kumar wrote:
> CPUFreq drivers today support ->get(cpu) callback, which returns current
> clock rate of the CPU. The problem with ->get() is that it takes cpu
> number as parameter and this unnecessarily makes things complex.
>
> Firstly the core gets the cpu number by doing operation 'policy->cpu' on
> the policy and then many drivers

I see one. That unfortunately is the acpi-cpufreq driver, but it still is one.

Well, cpufreq_generic_get() does _get_raw(), so I suppose acpi-cpufreq may
do that too?

> need to get the policy back and so do
> cpufreq_cpu_get(cpu) on the cpu passed as argument to ->get().
>
> It would be better if we pass them 'policy' directly and drivers can use
> policy->cpu if that's all they need.

Passing a pointer and dereferencing it is generally less efficient than passing
a number. Before the patch the core has to do the dereference before calling
->get, so it likely doesn't matter here, but the code churn from this change
is quite substantial and the benefit from it is in the noise IMO.

Overall, we need to talk about the design aspect of cpufreq, because there
are much more significant issues in it than things like this one.

Thanks,
Rafael



\
 
 \ /
  Last update: 2015-09-10 03:41    [W:0.210 / U:2.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site