pass: gov: Fix bug radiation governor when the number of load entry is zero
authorChanwoo Choi <cw00.choi@samsung.com>
Thu, 19 Jan 2017 09:46:29 +0000 (18:46 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 23 Jan 2017 11:06:00 +0000 (20:06 +0900)
The radiation governor uses the history of CPU utilization
in order to decide the proper pass level. If CPU idle time
is over period time (default 400ms), there is no any history
of cpu utilization. If the number of history is zero,
the governor have to return with previous pass level.

So, this patch handle the error case if the number
of load entry is zero.

Change-Id: If32d334b21059a5c889c866a0e70f41181133ebd
Reported-by: Eunki Hong <eunkiki.hong@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/pass/pass-gov-radiation.c

index 27b0b4ae92bf4ebcf41cd1117ebba0579f6f1137..2a72258431e57e8f2efde51b4bbc19e8f402567b 100644 (file)
@@ -168,6 +168,9 @@ int pass_radiation_governor(struct pass_policy *policy)
                }
        }
 
+       if (!num_pass_gov)
+               return level;
+
        if (up_count * 100 >= num_pass_gov * up_threshold) {
                level += policy->cpufreq.num_nr_cpus;