weighted_cpuload() gives the sum of priority scaled task loads. One NICE 0 task is not be enough load to trigger a cpu capacity increase when cpu_power > 1024. The rq->avg.runnable_avg_sum tracks the actual busy time of the cpu and is therefore a more accurate indication of the cpu load. If the rq tracked load is high the cpu is busy even if the weighted_cpuload() should indicate otherwise.
Signed-off-by: Morten Rasmussen morten.rasmussen@arm.com --- kernel/sched/fair.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ea8d973..ee87e65 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2861,7 +2861,17 @@ static inline void inc_cpu_capacity(int cpu, struct task_struct *p) if (p && p->flags & PF_WQ_WORKER) return;
- if (weighted_cpuload(cpu) > power_of(cpu)) + if (weighted_cpuload(cpu) > power_of(cpu)) { + go_faster(cpu, 0); + return; + } + + /* + * Go faster if the cpu is 80% busy. This threshold should + * be set by the power driver later. + */ + if (cpu_rq(cpu)->avg.runnable_avg_sum * 100 > + 80 * cpu_rq(cpu)->avg.runnable_avg_period) go_faster(cpu, 0); }