diff options
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq_conservative.c | 29 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_ondemand.c | 33 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_stats.c | 5 |
3 files changed, 32 insertions, 35 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index c97b468ee9f7..7f31a031c0b5 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -103,15 +103,14 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, | |||
103 | cputime64_t busy_time; | 103 | cputime64_t busy_time; |
104 | 104 | ||
105 | cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); | 105 | cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); |
106 | busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user, | 106 | busy_time = kstat_cpu(cpu).cpustat.user; |
107 | kstat_cpu(cpu).cpustat.system); | 107 | busy_time += kstat_cpu(cpu).cpustat.system; |
108 | 108 | busy_time += kstat_cpu(cpu).cpustat.irq; | |
109 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq); | 109 | busy_time += kstat_cpu(cpu).cpustat.softirq; |
110 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq); | 110 | busy_time += kstat_cpu(cpu).cpustat.steal; |
111 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal); | 111 | busy_time += kstat_cpu(cpu).cpustat.nice; |
112 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.nice); | 112 | |
113 | 113 | idle_time = cur_wall_time - busy_time; | |
114 | idle_time = cputime64_sub(cur_wall_time, busy_time); | ||
115 | if (wall) | 114 | if (wall) |
116 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); | 115 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); |
117 | 116 | ||
@@ -353,20 +352,20 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
353 | 352 | ||
354 | cur_idle_time = get_cpu_idle_time(j, &cur_wall_time); | 353 | cur_idle_time = get_cpu_idle_time(j, &cur_wall_time); |
355 | 354 | ||
356 | wall_time = (unsigned int) cputime64_sub(cur_wall_time, | 355 | wall_time = (unsigned int) |
357 | j_dbs_info->prev_cpu_wall); | 356 | (cur_wall_time - j_dbs_info->prev_cpu_wall); |
358 | j_dbs_info->prev_cpu_wall = cur_wall_time; | 357 | j_dbs_info->prev_cpu_wall = cur_wall_time; |
359 | 358 | ||
360 | idle_time = (unsigned int) cputime64_sub(cur_idle_time, | 359 | idle_time = (unsigned int) |
361 | j_dbs_info->prev_cpu_idle); | 360 | (cur_idle_time - j_dbs_info->prev_cpu_idle); |
362 | j_dbs_info->prev_cpu_idle = cur_idle_time; | 361 | j_dbs_info->prev_cpu_idle = cur_idle_time; |
363 | 362 | ||
364 | if (dbs_tuners_ins.ignore_nice) { | 363 | if (dbs_tuners_ins.ignore_nice) { |
365 | cputime64_t cur_nice; | 364 | cputime64_t cur_nice; |
366 | unsigned long cur_nice_jiffies; | 365 | unsigned long cur_nice_jiffies; |
367 | 366 | ||
368 | cur_nice = cputime64_sub(kstat_cpu(j).cpustat.nice, | 367 | cur_nice = kstat_cpu(j).cpustat.nice - |
369 | j_dbs_info->prev_cpu_nice); | 368 | j_dbs_info->prev_cpu_nice; |
370 | /* | 369 | /* |
371 | * Assumption: nice time between sampling periods will | 370 | * Assumption: nice time between sampling periods will |
372 | * be less than 2^32 jiffies for 32 bit sys | 371 | * be less than 2^32 jiffies for 32 bit sys |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index fa8af4ebb1d6..07cffe2f6cff 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -127,15 +127,14 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu, | |||
127 | cputime64_t busy_time; | 127 | cputime64_t busy_time; |
128 | 128 | ||
129 | cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); | 129 | cur_wall_time = jiffies64_to_cputime64(get_jiffies_64()); |
130 | busy_time = cputime64_add(kstat_cpu(cpu).cpustat.user, | 130 | busy_time = kstat_cpu(cpu).cpustat.user; |
131 | kstat_cpu(cpu).cpustat.system); | 131 | busy_time += kstat_cpu(cpu).cpustat.system; |
132 | 132 | busy_time += kstat_cpu(cpu).cpustat.irq; | |
133 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq); | 133 | busy_time += kstat_cpu(cpu).cpustat.softirq; |
134 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq); | 134 | busy_time += kstat_cpu(cpu).cpustat.steal; |
135 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal); | 135 | busy_time += kstat_cpu(cpu).cpustat.nice; |
136 | busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.nice); | 136 | |
137 | 137 | idle_time = cur_wall_time - busy_time; | |
138 | idle_time = cputime64_sub(cur_wall_time, busy_time); | ||
139 | if (wall) | 138 | if (wall) |
140 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); | 139 | *wall = (cputime64_t)jiffies_to_usecs(cur_wall_time); |
141 | 140 | ||
@@ -442,24 +441,24 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
442 | cur_idle_time = get_cpu_idle_time(j, &cur_wall_time); | 441 | cur_idle_time = get_cpu_idle_time(j, &cur_wall_time); |
443 | cur_iowait_time = get_cpu_iowait_time(j, &cur_wall_time); | 442 | cur_iowait_time = get_cpu_iowait_time(j, &cur_wall_time); |
444 | 443 | ||
445 | wall_time = (unsigned int) cputime64_sub(cur_wall_time, | 444 | wall_time = (unsigned int) |
446 | j_dbs_info->prev_cpu_wall); | 445 | (cur_wall_time - j_dbs_info->prev_cpu_wall); |
447 | j_dbs_info->prev_cpu_wall = cur_wall_time; | 446 | j_dbs_info->prev_cpu_wall = cur_wall_time; |
448 | 447 | ||
449 | idle_time = (unsigned int) cputime64_sub(cur_idle_time, | 448 | idle_time = (unsigned int) |
450 | j_dbs_info->prev_cpu_idle); | 449 | (cur_idle_time - j_dbs_info->prev_cpu_idle); |
451 | j_dbs_info->prev_cpu_idle = cur_idle_time; | 450 | j_dbs_info->prev_cpu_idle = cur_idle_time; |
452 | 451 | ||
453 | iowait_time = (unsigned int) cputime64_sub(cur_iowait_time, | 452 | iowait_time = (unsigned int) |
454 | j_dbs_info->prev_cpu_iowait); | 453 | (cur_iowait_time - j_dbs_info->prev_cpu_iowait); |
455 | j_dbs_info->prev_cpu_iowait = cur_iowait_time; | 454 | j_dbs_info->prev_cpu_iowait = cur_iowait_time; |
456 | 455 | ||
457 | if (dbs_tuners_ins.ignore_nice) { | 456 | if (dbs_tuners_ins.ignore_nice) { |
458 | cputime64_t cur_nice; | 457 | cputime64_t cur_nice; |
459 | unsigned long cur_nice_jiffies; | 458 | unsigned long cur_nice_jiffies; |
460 | 459 | ||
461 | cur_nice = cputime64_sub(kstat_cpu(j).cpustat.nice, | 460 | cur_nice = kstat_cpu(j).cpustat.nice - |
462 | j_dbs_info->prev_cpu_nice); | 461 | j_dbs_info->prev_cpu_nice; |
463 | /* | 462 | /* |
464 | * Assumption: nice time between sampling periods will | 463 | * Assumption: nice time between sampling periods will |
465 | * be less than 2^32 jiffies for 32 bit sys | 464 | * be less than 2^32 jiffies for 32 bit sys |
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index c5072a91e848..2a508edd768b 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c | |||
@@ -61,9 +61,8 @@ static int cpufreq_stats_update(unsigned int cpu) | |||
61 | spin_lock(&cpufreq_stats_lock); | 61 | spin_lock(&cpufreq_stats_lock); |
62 | stat = per_cpu(cpufreq_stats_table, cpu); | 62 | stat = per_cpu(cpufreq_stats_table, cpu); |
63 | if (stat->time_in_state) | 63 | if (stat->time_in_state) |
64 | stat->time_in_state[stat->last_index] = | 64 | stat->time_in_state[stat->last_index] += |
65 | cputime64_add(stat->time_in_state[stat->last_index], | 65 | cur_time - stat->last_time; |
66 | cputime_sub(cur_time, stat->last_time)); | ||
67 | stat->last_time = cur_time; | 66 | stat->last_time = cur_time; |
68 | spin_unlock(&cpufreq_stats_lock); | 67 | spin_unlock(&cpufreq_stats_lock); |
69 | return 0; | 68 | return 0; |