Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cpufreq: governor: Change confusing struct field and variable names

The name of the prev_cpu_wall field in struct cpu_dbs_info is
confusing, because it doesn't represent wall time, but the previous
update time as returned by get_cpu_idle_time() (that may be the
current value of jiffies_64 in some cases, for example).

Moreover, the names of some related variables in dbs_update() take
that confusion further.

Rename all of those things to make their names reflect the purpose
more accurately. While at it, drop unnecessary parens from one of
the updated expressions.

No functional changes.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Chen Yu <yu.c.chen@intel.com>

+12 -12
+11 -11
drivers/cpufreq/cpufreq_governor.c
··· 103 103 for_each_cpu(j, policy_dbs->policy->cpus) { 104 104 struct cpu_dbs_info *j_cdbs = &per_cpu(cpu_dbs, j); 105 105 106 - j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_cpu_wall, 106 + j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time, 107 107 dbs_data->io_is_busy); 108 108 if (dbs_data->ignore_nice_load) 109 109 j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE]; ··· 137 137 /* Get Absolute Load */ 138 138 for_each_cpu(j, policy->cpus) { 139 139 struct cpu_dbs_info *j_cdbs = &per_cpu(cpu_dbs, j); 140 - u64 cur_wall_time, cur_idle_time; 141 - unsigned int idle_time, wall_time; 140 + u64 update_time, cur_idle_time; 141 + unsigned int idle_time, time_elapsed; 142 142 unsigned int load; 143 143 144 - cur_idle_time = get_cpu_idle_time(j, &cur_wall_time, io_busy); 144 + cur_idle_time = get_cpu_idle_time(j, &update_time, io_busy); 145 145 146 - wall_time = cur_wall_time - j_cdbs->prev_cpu_wall; 147 - j_cdbs->prev_cpu_wall = cur_wall_time; 146 + time_elapsed = update_time - j_cdbs->prev_update_time; 147 + j_cdbs->prev_update_time = update_time; 148 148 149 149 idle_time = cur_idle_time - j_cdbs->prev_cpu_idle; 150 150 j_cdbs->prev_cpu_idle = cur_idle_time; ··· 156 156 j_cdbs->prev_cpu_nice = cur_nice; 157 157 } 158 158 159 - if (unlikely(!wall_time || wall_time < idle_time)) 159 + if (unlikely(!time_elapsed || time_elapsed < idle_time)) 160 160 continue; 161 161 162 162 /* ··· 177 177 * 178 178 * Detecting this situation is easy: the governor's utilization 179 179 * update handler would not have run during CPU-idle periods. 180 - * Hence, an unusually large 'wall_time' (as compared to the 180 + * Hence, an unusually large 'time_elapsed' (as compared to the 181 181 * sampling rate) indicates this scenario. 182 182 * 183 183 * prev_load can be zero in two cases and we must recalculate it ··· 185 185 * - during long idle intervals 186 186 * - explicitly set to zero 187 187 */ 188 - if (unlikely(wall_time > (2 * sampling_rate) && 188 + if (unlikely(time_elapsed > 2 * sampling_rate && 189 189 j_cdbs->prev_load)) { 190 190 load = j_cdbs->prev_load; 191 191 ··· 196 196 */ 197 197 j_cdbs->prev_load = 0; 198 198 } else { 199 - load = 100 * (wall_time - idle_time) / wall_time; 199 + load = 100 * (time_elapsed - idle_time) / time_elapsed; 200 200 j_cdbs->prev_load = load; 201 201 } 202 202 ··· 509 509 for_each_cpu(j, policy->cpus) { 510 510 struct cpu_dbs_info *j_cdbs = &per_cpu(cpu_dbs, j); 511 511 512 - j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_cpu_wall, io_busy); 512 + j_cdbs->prev_cpu_idle = get_cpu_idle_time(j, &j_cdbs->prev_update_time, io_busy); 513 513 /* 514 514 * Make the first invocation of dbs_update() compute the load. 515 515 */
+1 -1
drivers/cpufreq/cpufreq_governor.h
··· 111 111 /* Per cpu structures */ 112 112 struct cpu_dbs_info { 113 113 u64 prev_cpu_idle; 114 - u64 prev_cpu_wall; 114 + u64 prev_update_time; 115 115 u64 prev_cpu_nice; 116 116 /* 117 117 * Used to keep track of load in the previous interval. However, when