Merge 4.14.109 into android-4.14-p
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / kernel / sched / cpufreq_schedutil.c
index 1f525acba1fb49cf550a0da44a3bb300131ff2e2..6cbd2b9d574832f578a45a96b4f025e060cd00c3 100644 (file)
@@ -19,7 +19,7 @@
 
 #include "sched.h"
 
-unsigned long boosted_cpu_util(int cpu);
+unsigned long boosted_cpu_util(int cpu, unsigned long other_util);
 
 #define SUGOV_KTHREAD_PRIORITY 50
 
@@ -216,7 +216,7 @@ static void sugov_get_util(unsigned long *util, unsigned long *max, int cpu)
 
        rt = sched_get_rt_rq_util(cpu);
 
-       *util = boosted_cpu_util(cpu) + rt;
+       *util = boosted_cpu_util(cpu, rt);
        *util = min(*util, max_cap);
        *max = max_cap;
 }
@@ -316,7 +316,8 @@ static void sugov_update_single(struct update_util_data *hook, u64 time,
                 * Do not reduce the frequency if the CPU has not been idle
                 * recently, as the reduction is likely to be premature then.
                 */
-               if (busy && next_f < sg_policy->next_freq) {
+               if (busy && next_f < sg_policy->next_freq &&
+                   sg_policy->next_freq != UINT_MAX) {
                        next_f = sg_policy->next_freq;
 
                        /* Reset cached freq as next_freq has changed */
@@ -681,10 +682,9 @@ fail:
 
 stop_kthread:
        sugov_kthread_stop(sg_policy);
-
-free_sg_policy:
        mutex_unlock(&global_tunables_lock);
 
+free_sg_policy:
        sugov_policy_free(sg_policy);
 
 disable_fast_switch: