diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/core.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index aee448df0f41..eb6480b51d93 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1288,8 +1288,12 @@ static inline u64 scale_exec_time(u64 delta, struct rq *rq) rq->max_freq < rq->max_possible_freq))) cur_freq = rq->max_possible_freq; - delta = div64_u64(delta * cur_freq, max_possible_freq); - sf = (rq->efficiency * 1024) / max_possible_efficiency; + /* round up div64 */ + delta = div64_u64(delta * cur_freq + max_possible_freq - 1, + max_possible_freq); + + sf = DIV_ROUND_UP(rq->efficiency * 1024, max_possible_efficiency); + delta *= sf; delta >>= 10; @@ -2332,7 +2336,8 @@ unsigned long capacity_scale_cpu_freq(int cpu) */ static inline unsigned long load_scale_cpu_efficiency(int cpu) { - return (1024 * max_possible_efficiency) / cpu_rq(cpu)->efficiency; + return DIV_ROUND_UP(1024 * max_possible_efficiency, + cpu_rq(cpu)->efficiency); } /* @@ -2342,7 +2347,7 @@ static inline unsigned long load_scale_cpu_efficiency(int cpu) */ static inline unsigned long load_scale_cpu_freq(int cpu) { - return (1024 * max_possible_freq) / cpu_rq(cpu)->max_freq; + return DIV_ROUND_UP(1024 * max_possible_freq, cpu_rq(cpu)->max_freq); } static int compute_capacity(int cpu) |
