diff options
author | Stratos Karafotis <stratosk@semaphore.gr> | 2013-02-28 11:57:32 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-03-31 19:11:35 -0400 |
commit | 9366d84052e7c5b2eca804c08cfcd00b490f4de2 (patch) | |
tree | 0f159a425d29f1c6be12dbf30f18a55b79ae72d2 /drivers/cpufreq/cpufreq_ondemand.c | |
parent | fed573d5c91ab8f12801740cfac0567e33635b1e (diff) |
cpufreq: governors: Calculate iowait time only when necessary
Currently we always calculate the CPU iowait time and add it to idle time.
If we are in ondemand and we use io_is_busy, we re-calculate iowait time
and we subtract it from idle time.
With this patch iowait time is calculated only when necessary avoiding
the double call to get_cpu_iowait_time_us. We use a parameter in
function get_cpu_idle_time to distinguish when the iowait time will be
added to idle time or not, without the need of keeping the prev_io_wait.
Signed-off-by: Stratos Karafotis <stratosk@semaphore.gr>
Acked-by: Viresh Kumar <viresh.kumar@linaro.,org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_ondemand.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 459f9ee39c74..14714787b724 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -339,11 +339,20 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, | |||
339 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 339 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
340 | unsigned int input; | 340 | unsigned int input; |
341 | int ret; | 341 | int ret; |
342 | unsigned int j; | ||
342 | 343 | ||
343 | ret = sscanf(buf, "%u", &input); | 344 | ret = sscanf(buf, "%u", &input); |
344 | if (ret != 1) | 345 | if (ret != 1) |
345 | return -EINVAL; | 346 | return -EINVAL; |
346 | od_tuners->io_is_busy = !!input; | 347 | od_tuners->io_is_busy = !!input; |
348 | |||
349 | /* we need to re-evaluate prev_cpu_idle */ | ||
350 | for_each_online_cpu(j) { | ||
351 | struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, | ||
352 | j); | ||
353 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | ||
354 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); | ||
355 | } | ||
347 | return count; | 356 | return count; |
348 | } | 357 | } |
349 | 358 | ||
@@ -414,7 +423,7 @@ static ssize_t store_ignore_nice(struct dbs_data *dbs_data, const char *buf, | |||
414 | struct od_cpu_dbs_info_s *dbs_info; | 423 | struct od_cpu_dbs_info_s *dbs_info; |
415 | dbs_info = &per_cpu(od_cpu_dbs_info, j); | 424 | dbs_info = &per_cpu(od_cpu_dbs_info, j); |
416 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, | 425 | dbs_info->cdbs.prev_cpu_idle = get_cpu_idle_time(j, |
417 | &dbs_info->cdbs.prev_cpu_wall); | 426 | &dbs_info->cdbs.prev_cpu_wall, od_tuners->io_is_busy); |
418 | if (od_tuners->ignore_nice) | 427 | if (od_tuners->ignore_nice) |
419 | dbs_info->cdbs.prev_cpu_nice = | 428 | dbs_info->cdbs.prev_cpu_nice = |
420 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; | 429 | kcpustat_cpu(j).cpustat[CPUTIME_NICE]; |