Commit 1b600da
PM: EM: Optimize em_cpu_energy() and remove division
The Energy Model (EM) can be modified at runtime which brings new
possibilities. The em_cpu_energy() is called by the Energy Aware Scheduler
(EAS) in its hot path. The energy calculation uses power value for
a given performance state (ps) and the CPU busy time as percentage for that
given frequency.
It is possible to avoid the division by 'scale_cpu' at runtime, because
EM is updated whenever new max capacity CPU is set in the system.
Use that feature and do the needed division during the calculation of the
coefficient 'ps->cost'. That enhanced 'ps->cost' value can be then just
multiplied simply by utilization:
pd_nrg = ps->cost * \Sum cpu_util
to get the needed energy for whole Performance Domain (PD).
With this optimization and earlier removal of map_util_freq(), the
em_cpu_energy() should run faster on the Big CPU by 1.43x and on the Little
CPU by 1.69x (RockPi 4B board).
Reviewed-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>1 parent e3f1164 commit 1b600da
2 files changed
Lines changed: 18 additions & 44 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | 118 | | |
140 | 119 | | |
141 | 120 | | |
| |||
249 | 228 | | |
250 | 229 | | |
251 | 230 | | |
252 | | - | |
253 | | - | |
| 231 | + | |
254 | 232 | | |
255 | 233 | | |
256 | 234 | | |
| |||
267 | 245 | | |
268 | 246 | | |
269 | 247 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 248 | + | |
273 | 249 | | |
274 | 250 | | |
275 | 251 | | |
| |||
282 | 258 | | |
283 | 259 | | |
284 | 260 | | |
285 | | - | |
286 | | - | |
| 261 | + | |
| 262 | + | |
287 | 263 | | |
288 | | - | |
289 | | - | |
290 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
291 | 267 | | |
292 | 268 | | |
293 | 269 | | |
294 | 270 | | |
295 | 271 | | |
296 | 272 | | |
297 | 273 | | |
298 | | - | |
| 274 | + | |
299 | 275 | | |
300 | | - | |
| 276 | + | |
| 277 | + | |
301 | 278 | | |
302 | 279 | | |
303 | 280 | | |
| |||
307 | 284 | | |
308 | 285 | | |
309 | 286 | | |
310 | | - | |
311 | | - | |
312 | | - | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
313 | 290 | | |
314 | 291 | | |
315 | 292 | | |
| |||
319 | 296 | | |
320 | 297 | | |
321 | 298 | | |
322 | | - | |
323 | | - | |
324 | | - | |
| 299 | + | |
325 | 300 | | |
326 | | - | |
| 301 | + | |
327 | 302 | | |
328 | 303 | | |
329 | 304 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
196 | 195 | | |
197 | 196 | | |
198 | 197 | | |
199 | | - | |
200 | 198 | | |
201 | 199 | | |
202 | 200 | | |
| |||
208 | 206 | | |
209 | 207 | | |
210 | 208 | | |
211 | | - | |
212 | | - | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
213 | 212 | | |
214 | 213 | | |
215 | 214 | | |
| |||
0 commit comments