mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yaxiong Tian <iambestgod@qq.com>
To: rafael@kernel.org, viresh.kumar@linaro.org, Pierre.Gondois@arm.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yaxiong Tian <tianyaxiong@kylinos.cn>
Subject: [PATCH 0/2]  Fix and optimize some comments in the CPCC EM model
Date: Wed,  9 Apr 2025 17:49:48 +0800	[thread overview]
Message-ID: <tencent_D6C4728C5C687C042BA7C156B0F3ECF7AE05@qq.com> (raw)

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


             reply	other threads:[~2025-04-09  9:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-09  9:49 Yaxiong Tian [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_D6C4728C5C687C042BA7C156B0F3ECF7AE05@qq.com \
    --to=iambestgod@qq.com \
    --cc=Pierre.Gondois@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tianyaxiong@kylinos.cn \
    --cc=viresh.kumar@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®