Skip to content

Commit aa69c36

Browse files
Qais YousefPeter Zijlstra
authored andcommitted
sched/fair: Consider capacity inversion in util_fits_cpu()
We do consider thermal pressure in util_fits_cpu() for uclamp_min only. With the exception of the biggest cores which by definition are the max performance point of the system and all tasks by definition should fit. Even under thermal pressure, the capacity of the biggest CPU is the highest in the system and should still fit every task. Except when it reaches capacity inversion point, then this is no longer true. We can handle this by using the inverted capacity as capacity_orig in util_fits_cpu(). Which not only addresses the problem above, but also ensure uclamp_max now considers the inverted capacity. Force fitting a task when a CPU is in this adverse state will contribute to making the thermal throttling last longer. Signed-off-by: Qais Yousef <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 44c7b80 commit aa69c36

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

kernel/sched/fair.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4465,12 +4465,16 @@ static inline int util_fits_cpu(unsigned long util,
44654465
* For uclamp_max, we can tolerate a drop in performance level as the
44664466
* goal is to cap the task. So it's okay if it's getting less.
44674467
*
4468-
* In case of capacity inversion, which is not handled yet, we should
4469-
* honour the inverted capacity for both uclamp_min and uclamp_max all
4470-
* the time.
4468+
* In case of capacity inversion we should honour the inverted capacity
4469+
* for both uclamp_min and uclamp_max all the time.
44714470
*/
4472-
capacity_orig = capacity_orig_of(cpu);
4473-
capacity_orig_thermal = capacity_orig - arch_scale_thermal_pressure(cpu);
4471+
capacity_orig = cpu_in_capacity_inversion(cpu);
4472+
if (capacity_orig) {
4473+
capacity_orig_thermal = capacity_orig;
4474+
} else {
4475+
capacity_orig = capacity_orig_of(cpu);
4476+
capacity_orig_thermal = capacity_orig - arch_scale_thermal_pressure(cpu);
4477+
}
44744478

44754479
/*
44764480
* We want to force a task to fit a cpu as implied by uclamp_max.

0 commit comments

Comments
 (0)