diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2016-02-08 22:31:32 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-03-09 08:40:58 -0500 |
commit | ff4b17895e3166084c76ae703cb1c757bcc59799 (patch) | |
tree | 8985a281466043f7777eb303917c1ce820835260 /drivers/cpufreq/cpufreq_governor.c | |
parent | d0684d3b8934cfb8171755cdb1fc87f4c0335655 (diff) |
cpufreq: governor: Move common tunables to 'struct dbs_data'
There are a few common tunables shared between the ondemand and
conservative governors. Move them to struct dbs_data to simplify
code.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Juri Lelli <juri.lelli@arm.com>
Tested-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com>
[ rjw: Changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index d6bd402a3237..3569782771ef 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -38,10 +38,9 @@ void dbs_check_cpu(struct cpufreq_policy *policy) | |||
38 | struct policy_dbs_info *policy_dbs = policy->governor_data; | 38 | struct policy_dbs_info *policy_dbs = policy->governor_data; |
39 | struct dbs_data *dbs_data = policy_dbs->dbs_data; | 39 | struct dbs_data *dbs_data = policy_dbs->dbs_data; |
40 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 40 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
41 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 41 | unsigned int sampling_rate = dbs_data->sampling_rate; |
42 | unsigned int sampling_rate; | 42 | unsigned int ignore_nice = dbs_data->ignore_nice_load; |
43 | unsigned int max_load = 0; | 43 | unsigned int max_load = 0; |
44 | unsigned int ignore_nice; | ||
45 | unsigned int j; | 44 | unsigned int j; |
46 | 45 | ||
47 | if (gov->governor == GOV_ONDEMAND) { | 46 | if (gov->governor == GOV_ONDEMAND) { |
@@ -54,13 +53,8 @@ void dbs_check_cpu(struct cpufreq_policy *policy) | |||
54 | * the 'sampling_rate', so as to keep the wake-up-from-idle | 53 | * the 'sampling_rate', so as to keep the wake-up-from-idle |
55 | * detection logic a bit conservative. | 54 | * detection logic a bit conservative. |
56 | */ | 55 | */ |
57 | sampling_rate = od_tuners->sampling_rate; | ||
58 | sampling_rate *= od_dbs_info->rate_mult; | 56 | sampling_rate *= od_dbs_info->rate_mult; |
59 | 57 | ||
60 | ignore_nice = od_tuners->ignore_nice_load; | ||
61 | } else { | ||
62 | sampling_rate = cs_tuners->sampling_rate; | ||
63 | ignore_nice = cs_tuners->ignore_nice_load; | ||
64 | } | 58 | } |
65 | 59 | ||
66 | /* Get Absolute Load */ | 60 | /* Get Absolute Load */ |
@@ -280,19 +274,6 @@ static void dbs_update_util_handler(struct update_util_data *data, u64 time, | |||
280 | atomic_dec(&policy_dbs->work_count); | 274 | atomic_dec(&policy_dbs->work_count); |
281 | } | 275 | } |
282 | 276 | ||
283 | static void set_sampling_rate(struct dbs_data *dbs_data, | ||
284 | struct dbs_governor *gov, | ||
285 | unsigned int sampling_rate) | ||
286 | { | ||
287 | if (gov->governor == GOV_CONSERVATIVE) { | ||
288 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | ||
289 | cs_tuners->sampling_rate = sampling_rate; | ||
290 | } else { | ||
291 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | ||
292 | od_tuners->sampling_rate = sampling_rate; | ||
293 | } | ||
294 | } | ||
295 | |||
296 | static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *policy, | 277 | static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *policy, |
297 | struct dbs_governor *gov) | 278 | struct dbs_governor *gov) |
298 | { | 279 | { |
@@ -384,8 +365,8 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy) | |||
384 | /* Bring kernel and HW constraints together */ | 365 | /* Bring kernel and HW constraints together */ |
385 | dbs_data->min_sampling_rate = max(dbs_data->min_sampling_rate, | 366 | dbs_data->min_sampling_rate = max(dbs_data->min_sampling_rate, |
386 | MIN_LATENCY_MULTIPLIER * latency); | 367 | MIN_LATENCY_MULTIPLIER * latency); |
387 | set_sampling_rate(dbs_data, gov, max(dbs_data->min_sampling_rate, | 368 | dbs_data->sampling_rate = max(dbs_data->min_sampling_rate, |
388 | latency * LATENCY_MULTIPLIER)); | 369 | LATENCY_MULTIPLIER * latency); |
389 | 370 | ||
390 | if (!have_governor_per_policy()) | 371 | if (!have_governor_per_policy()) |
391 | gov->gdbs_data = dbs_data; | 372 | gov->gdbs_data = dbs_data; |
@@ -456,16 +437,12 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy) | |||
456 | if (policy_dbs->policy) | 437 | if (policy_dbs->policy) |
457 | return -EBUSY; | 438 | return -EBUSY; |
458 | 439 | ||
459 | if (gov->governor == GOV_CONSERVATIVE) { | 440 | sampling_rate = dbs_data->sampling_rate; |
460 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 441 | ignore_nice = dbs_data->ignore_nice_load; |
461 | 442 | ||
462 | sampling_rate = cs_tuners->sampling_rate; | 443 | if (gov->governor == GOV_ONDEMAND) { |
463 | ignore_nice = cs_tuners->ignore_nice_load; | ||
464 | } else { | ||
465 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 444 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
466 | 445 | ||
467 | sampling_rate = od_tuners->sampling_rate; | ||
468 | ignore_nice = od_tuners->ignore_nice_load; | ||
469 | io_busy = od_tuners->io_is_busy; | 446 | io_busy = od_tuners->io_is_busy; |
470 | } | 447 | } |
471 | 448 | ||