[PATCH 0/2] Fix and optimize some comments in the CPCC EM model
From: Yaxiong Tian
Date: Wed Apr 09 2025 - 05:58:57 EST
From: Yaxiong Tian <tianyaxiong@xxxxxxxxxx>
Commit <740fcdc2c20ec> ("cpufreq: CPPC: Register EM based on efficiency
class information") introduced a very good feature. However, since commit
<1b600da510735a> ("PM: EM: Optimize em_cpu_energy() and remove division"),
the energy calculation formula in the EM model has changed. Therefore, some
comments need to be updated and corrected to avoid misunderstandings.
I carefully analyzed the code theoretically and found that the new energy
calculation formula doesn't affect the current code - in fact, it has brought
some improvements. For example, consider four efficiency classes (1, 2, 3, 4).
Under the old logic, there were cases where tasks would be scheduled to class 4
CPUs instead of class 3 CPUs. This happened because the old energy calculation
formula divided by CPU capacity, and since class 3 CPUs have lower capacity than
class 4, it sometimes went against the original intention.
Considering that the comments about CPPC_EM_COST_GAP might be confusing, I've
added some analytical comments before CPPC_EM_COST_GAP in the latest code to
help other developers better understand.
Of course, this is just my personal understanding - please point out if
there are any mistakes.
Yaxiong Tian (2):
cpufreq: cppc: Update and opt comment for cost calculation method
cpufreq: cppc: Add comments for CPPC_EM_COST_GAP calculation
drivers/cpufreq/cppc_cpufreq.c | 44 ++++++++++++++++++++++++++++++----
1 file changed, 40 insertions(+), 4 deletions(-)
--
2.25.1