pass: gov: Fix the bug of radiation governor
authorChanwoo Choi <cw00.choi@samsung.com>
Wed, 4 May 2016 11:45:49 +0000 (20:45 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 16 Jan 2017 11:35:37 +0000 (20:35 +0900)
This patch fixes the bug of radiation governor

Change-Id: Iba76f9646149871770a81f8aff39e39b6f673c47
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov-radiation.c

index 98b634f817e49aa054a27437dc2a95705e31ed9b..c4039598dc5899eced3b712703e67821e4a467b5 100644 (file)
@@ -168,15 +168,23 @@ int pass_radiation_governor(struct pass_policy *policy)
                }
        }
 
-       if (up_count * 100 >= num_pass_gov * up_threshold)
+       if (up_count * 100 >= num_pass_gov * up_threshold) {
                level += policy->cpufreq.num_nr_cpus;
-       else if (down_count * 100 >= num_pass_gov * down_threshold)
+
+               if (level > policy->max_level)
+                       level -= policy->cpufreq.num_nr_cpus;
+       } else if (down_count * 100 >= num_pass_gov * down_threshold) {
                level -= policy->cpufreq.num_nr_cpus;
+       }
 
-       if (right_count * 100 >= num_pass_gov * up_threshold)
+       if (right_count * 100 >= num_pass_gov * up_threshold) {
                level += 1;
-       else if (left_count * 100 >= num_pass_gov * down_threshold)
+
+               if (level > policy->max_level)
+                       level -= 1;
+       } else if (left_count * 100 >= num_pass_gov * down_threshold) {
                level -= 1;
+       }
 
        /*
        if (level == policy->prev_level) {