@@ -53,12 +53,7 @@ struct sugov_cpu {
53
53
unsigned int iowait_boost_max ;
54
54
u64 last_update ;
55
55
56
- /* The fields below are only needed when sharing a policy: */
57
- unsigned long util_cfs ;
58
- unsigned long util_dl ;
59
56
unsigned long bw_dl ;
60
- unsigned long util_rt ;
61
- unsigned long util_irq ;
62
57
unsigned long max ;
63
58
64
59
/* The field below is for single-CPU policies only: */
@@ -182,38 +177,31 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
182
177
return cpufreq_driver_resolve_freq (policy , freq );
183
178
}
184
179
185
- static void sugov_get_util (struct sugov_cpu * sg_cpu )
180
+ static unsigned long sugov_get_util (struct sugov_cpu * sg_cpu )
186
181
{
187
182
struct rq * rq = cpu_rq (sg_cpu -> cpu );
183
+ unsigned long util , irq , max ;
188
184
189
- sg_cpu -> max = arch_scale_cpu_capacity (NULL , sg_cpu -> cpu );
190
- sg_cpu -> util_cfs = cpu_util_cfs (rq );
191
- sg_cpu -> util_dl = cpu_util_dl (rq );
192
- sg_cpu -> bw_dl = cpu_bw_dl (rq );
193
- sg_cpu -> util_rt = cpu_util_rt (rq );
194
- sg_cpu -> util_irq = cpu_util_irq (rq );
195
- }
196
-
197
- static unsigned long sugov_aggregate_util (struct sugov_cpu * sg_cpu )
198
- {
199
- struct rq * rq = cpu_rq (sg_cpu -> cpu );
200
- unsigned long util , max = sg_cpu -> max ;
185
+ sg_cpu -> max = max = arch_scale_cpu_capacity (NULL , sg_cpu -> cpu );
186
+ sg_cpu -> bw_dl = cpu_bw_dl (rq );
201
187
202
188
if (rt_rq_is_runnable (& rq -> rt ))
203
- return sg_cpu -> max ;
189
+ return max ;
190
+
191
+ irq = cpu_util_irq (rq );
204
192
205
- if (unlikely (sg_cpu -> util_irq >= max ))
193
+ if (unlikely (irq >= max ))
206
194
return max ;
207
195
208
196
/* Sum rq utilization */
209
- util = sg_cpu -> util_cfs ;
210
- util += sg_cpu -> util_rt ;
197
+ util = cpu_util_cfs ( rq ) ;
198
+ util += cpu_util_rt ( rq ) ;
211
199
212
200
/*
213
201
* Interrupt time is not seen by RQS utilization so we can compare
214
202
* them with the CPU capacity
215
203
*/
216
- if ((util + sg_cpu -> util_dl ) >= max )
204
+ if ((util + cpu_util_dl ( rq ) ) >= max )
217
205
return max ;
218
206
219
207
/*
@@ -231,11 +219,11 @@ static unsigned long sugov_aggregate_util(struct sugov_cpu *sg_cpu)
231
219
*/
232
220
233
221
/* Weight RQS utilization to normal context window */
234
- util *= (max - sg_cpu -> util_irq );
222
+ util *= (max - irq );
235
223
util /= max ;
236
224
237
225
/* Add interrupt utilization */
238
- util += sg_cpu -> util_irq ;
226
+ util += irq ;
239
227
240
228
/* Add DL bandwidth requirement */
241
229
util += sg_cpu -> bw_dl ;
@@ -418,9 +406,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
418
406
419
407
busy = sugov_cpu_is_busy (sg_cpu );
420
408
421
- sugov_get_util (sg_cpu );
409
+ util = sugov_get_util (sg_cpu );
422
410
max = sg_cpu -> max ;
423
- util = sugov_aggregate_util (sg_cpu );
424
411
sugov_iowait_apply (sg_cpu , time , & util , & max );
425
412
next_f = get_next_freq (sg_policy , util , max );
426
413
/*
@@ -459,9 +446,8 @@ static unsigned int sugov_next_freq_shared(struct sugov_cpu *sg_cpu, u64 time)
459
446
struct sugov_cpu * j_sg_cpu = & per_cpu (sugov_cpu , j );
460
447
unsigned long j_util , j_max ;
461
448
462
- sugov_get_util (j_sg_cpu );
449
+ j_util = sugov_get_util (j_sg_cpu );
463
450
j_max = j_sg_cpu -> max ;
464
- j_util = sugov_aggregate_util (j_sg_cpu );
465
451
sugov_iowait_apply (j_sg_cpu , time , & j_util , & j_max );
466
452
467
453
if (j_util * max > j_max * util ) {
0 commit comments