The main updates in Linux 5.7 are: Implementation of "Thermal Pressure " that the task scheduler adjusts when the CPU overheats, so that the performance does not drop too much due to the frequency change by the governor.
Let's check this on an implementation basis!
The location of the modified source code is related to the schedule, so here.
Looking at the commit log, it's around here.
sched/pelt: Add support to track thermal pressure
Extrapolating on the existing framework to track rt/dl utilization using pelt signals, add a similar mechanism to track thermal pressure.
It extrapolates to an existing framework and uses the pert signal to track rt / dl utilization and add a similar mechanism to track thermal pressure.
The difference here from rt/dl utilization tracking is that, instead of tracking time spent by a CPU running a RT/DL task through util_avg, the average thermal pressure is tracked through load_avg.
The difference from rt / dl usage tracking is that instead of tracking the elapsed time of the CPU running the RT / DL task via util_avg, it tracks the average thermal pressure via load_avg.
This is because thermal pressure signal is weighted time "delta" capacity unlike util_avg which is binary.
This is because, unlike the binary util_avg, the thermal pressure signal is the "delta" capacity of the weighted time.
"delta capacity" here means delta between the actual capacity of a CPU and the decreased capacity a CPU due to a thermal event.
"Delta capacity" here means the difference between the actual capacity of the CPU and the capacity of the CPU reduced by the thermal event. .
In order to track average thermal pressure, a new sched_avg variable avg_thermal is introduced. Function update_thermal_load_avg can be called to do the periodic bookkeeping (accumulate, decay and average) of the thermal pressure.
In other words, the average thermal pressure is the introduction of the new sched_avg variable avg_thermal. The function update_thermal_load_avg is called to perform regular bookkeeping (cumulative, attenuation, averaging).
sched/fair: Enable periodic update of average thermal pressure
Introduce support in scheduler periodic tick and other CFS bookkeeping APIs to trigger the process of computing average thermal pressure for a CPU.
Within the scheduler, regular ticks and other CFS bookkeeping APIs support the triggering of CPU average thermal pressure calculations.
Also consider avg_thermal.load_avg in others_have_blocked which allows for decay of pelt signals.
Also, consider the other others_have_blocked avg_thermal.load_avg, among other blocked with the pert signal.
sched/fair: Update cpu_capacity to reflect thermal pressure
cpu_capacity initially reflects the maximum possible capacity of a CPU. Thermal pressure on a CPU means this maximum possible capacity is unavailable due to thermal events.
cpu_capacity is an initial reflection of the maximum permissible capacity of the CPU. The CPU Thermal Pressure is the maximum possible capacity disabled by a thermal event.
This patch subtracts the average thermal pressure for a CPU from its maximum possible capacity so that cpu_capacity reflects the remaining maximum capacity.
This patch subtracts the average thermal pressure of the CPU from the maximum possible capacity so that cpu_capacity reflects the remaining maximum capacity.
sched/fair: Enable tuning of decay period
Thermal pressure follows pelt signals which means the decay period for thermal pressure is the default pelt decay period.
Thermal pressure follows the pert signal. In other words, the thermal pressure decay time is the default pert decay period.
Depending on SoC characteristics and thermal activity, it might be beneficial to decay thermal pressure slower, but still in-tune with the pelt signals.
Depending on the characteristics of the SoC and the relative activity, it is beneficial to slowly attenuate the thermal pressure, but it is consistent with the pert signal.
One way to achieve this is to provide a command line parameter to set a decay shift parameter to an integer between 0 and 10.
One way to do this is to specify a command line parameter and set the attenuation shift parameter to an integer from 0 to 10.