sched: fix overflow in scaled execution time calculation
Task execution time in nanoseconds and CPU cycle counters are large enough to cause overflow when we multiply both. Avoid overflow by calculating frequency separately. Change-Id: I076d9ecd27cb1c1f11578f009ebe1a19c1619454 Signed-off-by: Joonwoo Park <joonwoop@codeaurora.org>
This commit is contained in:
parent
c07e88c80f
commit
14ac5ed8b8
1 changed files with 3 additions and 2 deletions
|
@ -1941,9 +1941,10 @@ static inline u64 scale_exec_time(u64 delta, struct rq *rq)
|
|||
{
|
||||
int cpu = cpu_of(rq);
|
||||
int sf;
|
||||
u32 freq;
|
||||
|
||||
delta = DIV64_U64_ROUNDUP(delta * rq->cc.cycles,
|
||||
max_possible_freq * rq->cc.time);
|
||||
freq = cpu_cycles_to_freq(rq->cc.cycles, rq->cc.time);
|
||||
delta = DIV64_U64_ROUNDUP(delta * freq, max_possible_freq);
|
||||
sf = DIV_ROUND_UP(cpu_efficiency(cpu) * 1024, max_possible_efficiency);
|
||||
|
||||
delta *= sf;
|
||||
|
|
Loading…
Add table
Reference in a new issue