mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 03:27:03 +02:00
sched: Fix negative capacity issue under thermal conditions
Currently, there is a issue in the system where the rt capacity could be greater than the thermal capacity, and as a consequence we could end up with a negative capacity in calculations. Change-Id: If81be87878ae7948b0278e30ac4a8618d434d070 Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
This commit is contained in:
parent
31f357a500
commit
3eeb00d318
|
|
@ -3821,31 +3821,32 @@ static void walt_cpu_frequency_limits(void *unused, struct cpufreq_policy *polic
|
|||
*/
|
||||
static void android_rvh_update_cpu_capacity(void *unused, int cpu, unsigned long *capacity)
|
||||
{
|
||||
unsigned long max_capacity = arch_scale_cpu_capacity(cpu);
|
||||
unsigned long fmax_capacity = arch_scale_cpu_capacity(cpu);
|
||||
unsigned long thermal_pressure = arch_scale_thermal_pressure(cpu);
|
||||
unsigned long thermal_cap;
|
||||
struct walt_sched_cluster *cluster;
|
||||
unsigned long rt_pressure = max_capacity - *capacity;
|
||||
unsigned long rt_pressure = fmax_capacity - *capacity;
|
||||
struct rq *rq = cpu_rq(cpu);
|
||||
|
||||
if (unlikely(walt_disabled))
|
||||
return;
|
||||
|
||||
/*
|
||||
* thermal_pressure = max_capacity - curr_cap_as_per_thermal.
|
||||
* thermal_pressure = cpu_scale - curr_cap_as_per_thermal.
|
||||
* so,
|
||||
* curr_cap_as_per_thermal = max_capacity - thermal_pressure.
|
||||
* curr_cap_as_per_thermal = cpu_scale - thermal_pressure.
|
||||
*/
|
||||
|
||||
thermal_cap = max_capacity - thermal_pressure;
|
||||
thermal_cap = fmax_capacity - thermal_pressure;
|
||||
|
||||
cluster = cpu_cluster(cpu);
|
||||
/* reduce the max_capacity under cpufreq constraints */
|
||||
/* reduce the fmax_capacity under cpufreq constraints */
|
||||
if (cluster->max_freq != cluster->max_possible_freq)
|
||||
max_capacity = mult_frac(max_capacity, cluster->max_freq,
|
||||
fmax_capacity = mult_frac(fmax_capacity, cluster->max_freq,
|
||||
cluster->max_possible_freq);
|
||||
|
||||
cpu_rq(cpu)->cpu_capacity_orig = min(max_capacity, thermal_cap);
|
||||
*capacity = cpu_rq(cpu)->cpu_capacity_orig - rt_pressure;
|
||||
rq->cpu_capacity_orig = min(fmax_capacity, thermal_cap);
|
||||
*capacity = max(rq->cpu_capacity_orig - rt_pressure, 1UL);
|
||||
}
|
||||
|
||||
static void android_rvh_sched_cpu_starting(void *unused, int cpu)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user