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

Skip to content
Commit fc75f666 authored by Pavankumar Kondeti's avatar Pavankumar Kondeti
Browse files

sched/fair: Fix CPU capacity updates in update_cpu_capacity()



The update_cpu_capacity() is periodically called from load balancer
to update the CPU capacity. The CPU capacity (rq->capacity) may
change based on the cpufreq max_freq constraints and RT/IRQ load.
The original CPU capacity (rq->cpu_capacity_orig) is also changed
based on the thermal cap in this function. Since the capacity_orig
is change, the max_cpu_capacity.val is also updated. However two
quantities are out of sync when cpufreq policy max is trimmed. This
can result task_fits_max() returns false on a highest capacity cluster
and mark misfit task status incorrectly.

Make cpu_orig_capacity reflect the current cpufreq max_freq constraints.
This is very important because we use cpu_capacity_orig to check if a
task fits on a given CPU or not. When the CPU frequency is throttled
via cpufreq policy, a task's utilization or demand is limited by the
current max frequency. This is on the right hand side of the below
equation. To compensate this the original capacity (on the left hand
side) must be trimmed to reflect the lowered max frequency.

task_fits = capacity_orig * 1024 > task_util(p) * margin;

This patch also fixes another problem where rq->capacity is incorrectly
updated when cpufreq policy max is trimmed and thermal_cap() also
returns a lower value than its original capacity. First we ceil the
capacity to thermal_cap then the effective value is used to scale
the capacity as per max_freq constraints. Instead we should be
scaling the original capacity as per max_freq constraints and ceil
it to the thermal_cap().

Change-Id: I5b514d1639c5be1cd66bd3bee08e2b351160aee1
Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
parent 2aea12dd
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment