sched/uclamp: Make cpu_overutilized() use util_fits_cpu()
authorQais Yousef <qais.yousef@arm.com>
Thu, 4 Aug 2022 14:36:06 +0000 (15:36 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:31:55 +0000 (13:31 +0100)
commitcbd8c040409cd7343db655d4b0fc702bfd9560f6
tree8a2523824bd1ab6a5d3c16c0ea0700fbbbfe8de8
parent324ce6e2c603a8e53c1b5b8f7d66eec41275ff89
sched/uclamp: Make cpu_overutilized() use util_fits_cpu()

[ Upstream commit c56ab1b3506ba0e7a872509964b100912bde165d ]

So that it is now uclamp aware.

This fixes a major problem of busy tasks capped with UCLAMP_MAX keeping
the system in overutilized state which disables EAS and leads to wasting
energy in the long run.

Without this patch running a busy background activity like JIT
compilation on Pixel 6 causes the system to be in overutilized state
74.5% of the time.

With this patch this goes down to  9.79%.

It also fixes another problem when long running tasks that have their
UCLAMP_MIN changed while running such that they need to upmigrate to
honour the new UCLAMP_MIN value. The upmigration doesn't get triggered
because overutilized state never gets set in this state, hence misfit
migration never happens at tick in this case until the task wakes up
again.

Fixes: af24bde8df202 ("sched/uclamp: Add uclamp support to energy_compute()")
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20220804143609.515789-7-qais.yousef@arm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/sched/fair.c