@@ -7229,10 +7229,10 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
7229
7229
eenv_task_busy_time (& eenv , p , prev_cpu );
7230
7230
7231
7231
for (; pd ; pd = pd -> next ) {
7232
+ unsigned long util_min = p_util_min , util_max = p_util_max ;
7232
7233
unsigned long cpu_cap , cpu_thermal_cap , util ;
7233
7234
unsigned long cur_delta , max_spare_cap = 0 ;
7234
7235
unsigned long rq_util_min , rq_util_max ;
7235
- unsigned long util_min , util_max ;
7236
7236
unsigned long prev_spare_cap = 0 ;
7237
7237
int max_spare_cap_cpu = -1 ;
7238
7238
unsigned long base_energy ;
@@ -7251,6 +7251,8 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
7251
7251
eenv .pd_cap = 0 ;
7252
7252
7253
7253
for_each_cpu (cpu , cpus ) {
7254
+ struct rq * rq = cpu_rq (cpu );
7255
+
7254
7256
eenv .pd_cap += cpu_thermal_cap ;
7255
7257
7256
7258
if (!cpumask_test_cpu (cpu , sched_domain_span (sd )))
@@ -7269,24 +7271,19 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
7269
7271
* much capacity we can get out of the CPU; this is
7270
7272
* aligned with sched_cpu_util().
7271
7273
*/
7272
- if (uclamp_is_used ()) {
7273
- if (uclamp_rq_is_idle (cpu_rq (cpu ))) {
7274
- util_min = p_util_min ;
7275
- util_max = p_util_max ;
7276
- } else {
7277
- /*
7278
- * Open code uclamp_rq_util_with() except for
7279
- * the clamp() part. Ie: apply max aggregation
7280
- * only. util_fits_cpu() logic requires to
7281
- * operate on non clamped util but must use the
7282
- * max-aggregated uclamp_{min, max}.
7283
- */
7284
- rq_util_min = uclamp_rq_get (cpu_rq (cpu ), UCLAMP_MIN );
7285
- rq_util_max = uclamp_rq_get (cpu_rq (cpu ), UCLAMP_MAX );
7286
-
7287
- util_min = max (rq_util_min , p_util_min );
7288
- util_max = max (rq_util_max , p_util_max );
7289
- }
7274
+ if (uclamp_is_used () && !uclamp_rq_is_idle (rq )) {
7275
+ /*
7276
+ * Open code uclamp_rq_util_with() except for
7277
+ * the clamp() part. Ie: apply max aggregation
7278
+ * only. util_fits_cpu() logic requires to
7279
+ * operate on non clamped util but must use the
7280
+ * max-aggregated uclamp_{min, max}.
7281
+ */
7282
+ rq_util_min = uclamp_rq_get (rq , UCLAMP_MIN );
7283
+ rq_util_max = uclamp_rq_get (rq , UCLAMP_MAX );
7284
+
7285
+ util_min = max (rq_util_min , p_util_min );
7286
+ util_max = max (rq_util_max , p_util_max );
7290
7287
}
7291
7288
if (!util_fits_cpu (util , util_min , util_max , cpu ))
7292
7289
continue ;
0 commit comments