Hi,
What is the difference between cpufreq policy and governors?
Are there a different cpufreq policy structure created for each cpu? Will policy structure change when governor changes or when will it change?
thanks, ryan
On 26 May 2014 00:27, Ryan ryanphilips19@googlemail.com wrote:
What is the difference between cpufreq policy and governors?
Probably you can go through Documentation/cpu-freq/* for this information. Governor decides which frequency you will switch to and when. Policy decides which frequencies you *can* switch to.
Are there a different cpufreq policy structure created for each cpu?
A separate policy exists for each group of CPU sharing clock line. So, it may happen that there is a policy per CPU if they don't share clock line at all..
Will policy structure change when governor changes or when will it change?
Policy structure doesn't change with governor. It will get updated only when you try to play with min/max frequency a CPU can switch to OR hotplug/unplug a CPU..
Hi,
Thanks for your help.
I was trying to print the policy pointer of each cpu - and it points to the same address for all cpus. But could not find the code which does that (when cpu is added it should point to the same structure)
Also as i undertsand: CPUFREQ_GOV_POLICY_INIT and CPUFREQ_GOV_POLICY_EXIT is called only when we change the governor.
When we add a cpu we do CPUFREQ_GOV_STOP, CPUFREQ_GOV_START and CPUFREQ_GOV_LIMITS. I did not understand why we need to do this when we add or remove cpu's.
Thanks, ryan
On Mon, May 26, 2014 at 9:39 AM, Viresh Kumar viresh.kumar@linaro.org wrote:
On 26 May 2014 00:27, Ryan ryanphilips19@googlemail.com wrote:
What is the difference between cpufreq policy and governors?
Probably you can go through Documentation/cpu-freq/* for this information. Governor decides which frequency you will switch to and when. Policy decides which frequencies you *can* switch to.
Are there a different cpufreq policy structure created for each cpu?
A separate policy exists for each group of CPU sharing clock line. So, it may happen that there is a policy per CPU if they don't share clock line at all..
Will policy structure change when governor changes or when will it change?
Policy structure doesn't change with governor. It will get updated only when you try to play with min/max frequency a CPU can switch to OR hotplug/unplug a CPU..
On 26 May 2014 10:53, Ryan ryanphilips19@googlemail.com wrote:
Thanks for your help.
Your welcome..
I was trying to print the policy pointer of each cpu - and it points to the same address for all cpus.
Good, so all CPUs are sharing the same clock line in your case. You are probably using an ARM board :)
But could not find the code which does that (when cpu is added it should point to the same structure)
static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) ... for_each_cpu(j, policy->cpus) per_cpu(cpufreq_cpu_data, j) = policy;
Also as i undertsand: CPUFREQ_GOV_POLICY_INIT and CPUFREQ_GOV_POLICY_EXIT is called only when we change the governor.
No. It is called when we allocate/create policy structure for the first time. So, once for every group of CPUs sharing clock line.
When we add a cpu we do CPUFREQ_GOV_STOP, CPUFREQ_GOV_START and CPUFREQ_GOV_LIMITS. I did not understand why we need to do this when we add or remove cpu's.
Because we need to updated policy->cpus, i.e. CPUs managed by this policy. Most of the governors today, schedule a per-cpu time based on this field only.