cpufreq: ondemand: Update sampling rate only for concerned policies
authorViresh Kumar <viresh.kumar@linaro.org>
Thu, 3 Dec 2015 04:07:49 +0000 (09:37 +0530)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 7 Dec 2015 01:20:10 +0000 (02:20 +0100)
commite128c864070055e062f6c90c64c03aad18452ac3
tree42f57d730c2d84589821c80c23b0f1f56250b16d
parent527e9316f8ec44bd53d90fb9f611fa7ffff52bb9
cpufreq: ondemand: Update sampling rate only for concerned policies

We are comparing policy->governor against cpufreq_gov_ondemand to make
sure that we update sampling rate only for the concerned CPUs. But that
isn't enough.

In case of governor_per_policy, there can be multiple instances of
ondemand governor and we will always end up updating all of them with
current code. What we rather need to do, is to compare dbs_data with
poilcy->governor_data, which will match only for the policies governed
by dbs_data.

This code is also racy as the governor might be getting stopped at that
time and we may end up scheduling work for a policy, which we have just
disabled.

Fix that by protecting the entire function with &od_dbs_cdata.mutex,
which will prevent against races with policy START/STOP/etc.

After these locks are in place, we can safely get the policy via per-cpu
dbs_info.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq_ondemand.c
This page took 0.02736 seconds and 5 git commands to generate.