@@ -102,9 +102,12 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time)
102102static bool sugov_update_next_freq (struct sugov_policy * sg_policy , u64 time ,
103103 unsigned int next_freq )
104104{
105- if (sg_policy -> next_freq == next_freq &&
106- !cpufreq_driver_test_flags (CPUFREQ_NEED_UPDATE_LIMITS ))
107- return false;
105+ if (!sg_policy -> need_freq_update ) {
106+ if (sg_policy -> next_freq == next_freq )
107+ return false;
108+ } else {
109+ sg_policy -> need_freq_update = cpufreq_driver_test_flags (CPUFREQ_NEED_UPDATE_LIMITS );
110+ }
108111
109112 sg_policy -> next_freq = next_freq ;
110113 sg_policy -> last_freq_update_time = time ;
@@ -162,11 +165,9 @@ static unsigned int get_next_freq(struct sugov_policy *sg_policy,
162165
163166 freq = map_util_freq (util , freq , max );
164167
165- if (freq == sg_policy -> cached_raw_freq && !sg_policy -> need_freq_update &&
166- !cpufreq_driver_test_flags (CPUFREQ_NEED_UPDATE_LIMITS ))
168+ if (freq == sg_policy -> cached_raw_freq && !sg_policy -> need_freq_update )
167169 return sg_policy -> next_freq ;
168170
169- sg_policy -> need_freq_update = false;
170171 sg_policy -> cached_raw_freq = freq ;
171172 return cpufreq_driver_resolve_freq (policy , freq );
172173}
@@ -442,7 +443,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
442443 struct sugov_policy * sg_policy = sg_cpu -> sg_policy ;
443444 unsigned long util , max ;
444445 unsigned int next_f ;
445- bool busy ;
446446 unsigned int cached_freq = sg_policy -> cached_raw_freq ;
447447
448448 sugov_iowait_boost (sg_cpu , time , flags );
@@ -453,9 +453,6 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
453453 if (!sugov_should_update_freq (sg_policy , time ))
454454 return ;
455455
456- /* Limits may have changed, don't skip frequency update */
457- busy = !sg_policy -> need_freq_update && sugov_cpu_is_busy (sg_cpu );
458-
459456 util = sugov_get_util (sg_cpu );
460457 max = sg_cpu -> max ;
461458 util = sugov_iowait_apply (sg_cpu , time , util , max );
@@ -464,7 +461,7 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
464461 * Do not reduce the frequency if the CPU has not been idle
465462 * recently, as the reduction is likely to be premature then.
466463 */
467- if (busy && next_f < sg_policy -> next_freq ) {
464+ if (sugov_cpu_is_busy ( sg_cpu ) && next_f < sg_policy -> next_freq ) {
468465 next_f = sg_policy -> next_freq ;
469466
470467 /* Restore cached freq as next_freq has changed */
@@ -829,9 +826,10 @@ static int sugov_start(struct cpufreq_policy *policy)
829826 sg_policy -> next_freq = 0 ;
830827 sg_policy -> work_in_progress = false;
831828 sg_policy -> limits_changed = false;
832- sg_policy -> need_freq_update = false;
833829 sg_policy -> cached_raw_freq = 0 ;
834830
831+ sg_policy -> need_freq_update = cpufreq_driver_test_flags (CPUFREQ_NEED_UPDATE_LIMITS );
832+
835833 for_each_cpu (cpu , policy -> cpus ) {
836834 struct sugov_cpu * sg_cpu = & per_cpu (sugov_cpu , cpu );
837835
0 commit comments