From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux PM <linux-pm@vger.kernel.org>
Cc: Lukasz Luba <lukasz.luba@arm.com>,
LKML <linux-kernel@vger.kernel.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
Subject: [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead
Date: Mon, 27 Jan 2025 14:38:25 +0100 [thread overview]
Message-ID: <1925950.tdWV9SEqCh@rjwysocki.net> (raw)
In-Reply-To: <6137833.lOV4Wx5bFT@rjwysocki.net>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Every iteration of the loop over all possible CPUs in
em_check_capacity_update() causes get_cpu_device() to be called twice
for the same CPU, once indirectly via em_cpu_get() and once directly.
Get rid of the indirect get_cpu_device() call by moving the direct
invocation of it earlier and using em_pd_get() instead of em_cpu_get()
to get a pd pointer for the dev one returned by it.
This also exposes the fact that dev is needed to get a pd, so the code
becomes somewhat easier to follow after it.
No functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
kernel/power/energy_model.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/kernel/power/energy_model.c
+++ b/kernel/power/energy_model.c
@@ -774,7 +774,8 @@
}
cpufreq_cpu_put(policy);
- pd = em_cpu_get(cpu);
+ dev = get_cpu_device(cpu);
+ pd = em_pd_get(dev);
if (!pd || em_is_artificial(pd))
continue;
@@ -798,7 +799,6 @@
pr_debug("updating cpu%d cpu_cap=%lu old capacity=%lu\n",
cpu, cpu_capacity, em_max_perf);
- dev = get_cpu_device(cpu);
em_adjust_new_capacity(dev, pd);
}
next prev parent reply other threads:[~2025-01-27 13:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 13:10 [PATCH v1 0/2] PM: EM: Two cleanups related to em_check_capacity_update() Rafael J. Wysocki
2025-01-27 13:37 ` [PATCH v1 1/2] PM: EM: Drop unused parameter from em_adjust_new_capacity() Rafael J. Wysocki
2025-02-10 11:25 ` Lukasz Luba
2025-01-27 13:38 ` Rafael J. Wysocki [this message]
2025-02-10 11:26 ` [PATCH v1 2/2] PM: EM: Slightly reduce em_check_capacity_update() overhead Lukasz Luba
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=1925950.tdWV9SEqCh@rjwysocki.net \
--to=rjw@rjwysocki.net \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=ricardo.neri-calderon@linux.intel.com \
/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®