mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2]  Fix and optimize some comments in the CPCC EM model
@ 2025-04-09  9:49 Yaxiong Tian
  2025-04-09  9:51 ` [PATCH 1/2] cpufreq: cppc: Update and opt comment for cost calculation method Yaxiong Tian
  2025-04-09  9:51 ` [PATCH 2/2] cpufreq: cppc: Add comments for CPPC_EM_COST_GAP calculation Yaxiong Tian
  0 siblings, 2 replies; 3+ messages in thread
From: Yaxiong Tian @ 2025-04-09  9:49 UTC (permalink / raw)
  To: rafael, viresh.kumar, Pierre.Gondois; +Cc: linux-pm, linux-kernel, Yaxiong Tian

From: Yaxiong Tian <tianyaxiong@kylinos.cn>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-09 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-09  9:49 [PATCH 0/2] Fix and optimize some comments in the CPCC EM model Yaxiong Tian
2025-04-09  9:51 ` [PATCH 1/2] cpufreq: cppc: Update and opt comment for cost calculation method Yaxiong Tian
2025-04-09  9:51 ` [PATCH 2/2] cpufreq: cppc: Add comments for CPPC_EM_COST_GAP calculation Yaxiong Tian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®