Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1cac96e2 authored by bait_dispatcher_monitor_system's avatar bait_dispatcher_monitor_system Committed by Gerrit - the friendly Code Review server
Browse files

Merge "sched: fix rounding error on scaled execution time calculation"

parents 3dcf8c03 3a037e91
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -1269,8 +1269,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;

@@ -2313,7 +2317,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);
}

/*
@@ -2323,7 +2328,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)