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

Commit b0f71baf authored by Rick Yiu's avatar Rick Yiu Committed by Harshit Jain
Browse files

sched/fair: use actual cpu capacity to calculate boosted util



Currently when calculating boosted util for a cpu, it uses a fixed
value of 1024 for calculation. So when top-app tasks moved to LC,
which has much lower capacity than BC, the freq calculated will be
high even the cpu util is low. This results in higher power
consumption, especially on arch which has more little cores than
big cores. By replacing the fixed value of 1024 with actual cpu
capacity will reduce the freq calculated on LC.

Bug: 152925197
Test: boosted util reduced on little cores
Signed-off-by: default avatarRick Yiu <rickyiu@google.com>
Change-Id: I80cdd08a2c7fa5e674c43bfc132584d85c14622b
Signed-off-by: default avatarminaripenguin <minaripenguin@users.noreply.github.com>
parent 3526aba6
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -6687,7 +6687,7 @@ static int wake_affine(struct sched_domain *sd, struct task_struct *p,
struct reciprocal_value schedtune_spc_rdiv;

static long
schedtune_margin(unsigned long signal, long boost)
schedtune_margin(unsigned long signal, long boost, long capacity)
{
	long long margin = 0;

@@ -6700,8 +6700,10 @@ schedtune_margin(unsigned long signal, long boost)
	 * The obtained M could be used by the caller to "boost" S.
	 */
	if (boost >= 0) {
		margin  = SCHED_CAPACITY_SCALE - signal;
	    if (capacity > signal) {
			margin  = capacity - signal;
			margin *= boost;
		}
	} else
		margin = -signal * boost;

@@ -6720,7 +6722,7 @@ schedtune_cpu_margin(unsigned long util, int cpu)
	if (boost == 0)
		return 0;

	return schedtune_margin(util, boost);
	return schedtune_margin(util, boost, capacity_orig_of(cpu));
}

static inline long
@@ -6734,7 +6736,7 @@ schedtune_task_margin(struct task_struct *task)
		return 0;

	util = task_util_est(task);
	margin = schedtune_margin(util, boost);
	margin = schedtune_margin(util, boost, SCHED_CAPACITY_SCALE);

	return margin;
}