From: Lukasz Luba <lukasz.luba@arm.com>
To: linux-kernel@vger.kernel.org
Cc: lukasz.luba@arm.com, dietmar.eggemann@arm.com,
viresh.kumar@linaro.org, rafael@kernel.org,
daniel.lezcano@linaro.org, amitk@kernel.org, rui.zhang@intel.com,
amit.kachhap@gmail.com, linux-pm@vger.kernel.org
Subject: [RFC PATCH v3 2/5] cpuidle: Add Cpufreq Active Stats calls tracking idle entry/exit
Date: Wed, 6 Apr 2022 23:08:06 +0100 [thread overview]
Message-ID: <20220406220809.22555-3-lukasz.luba@arm.com> (raw)
In-Reply-To: <20220406220809.22555-1-lukasz.luba@arm.com>
The Cpufreq Active Stats tracks and accounts the activity of the CPU
for each performance level. It accounts the real residency, when the CPU
was not idle, at a given performance level. This patch adds needed calls
which provide the CPU idle entry/exit events to the Cpufreq Active Stats.
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
---
drivers/cpuidle/cpuidle.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index ef2ea1b12cd8..f19711b95afb 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -16,6 +16,7 @@
#include <linux/notifier.h>
#include <linux/pm_qos.h>
#include <linux/cpu.h>
+#include <linux/cpufreq_stats.h>
#include <linux/cpuidle.h>
#include <linux/ktime.h>
#include <linux/hrtimer.h>
@@ -231,6 +232,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
trace_cpu_idle(index, dev->cpu);
time_start = ns_to_ktime(local_clock());
+ cpufreq_active_stats_cpu_idle_enter(time_start);
+
stop_critical_timings();
if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
rcu_idle_enter();
@@ -243,6 +246,8 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
time_end = ns_to_ktime(local_clock());
trace_cpu_idle(PWR_EVENT_EXIT, dev->cpu);
+ cpufreq_active_stats_cpu_idle_exit(time_end);
+
/* The cpu is no longer idle or about to enter idle. */
sched_idle_set_state(NULL);
--
2.17.1
next prev parent reply other threads:[~2022-04-06 22:08 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-06 22:08 [RFC PATCH v3 0/5] Introduce Cpufreq Active Stats Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 1/5] cpufreq: stats: " Lukasz Luba
2022-04-06 22:08 ` Lukasz Luba [this message]
2022-04-26 12:05 ` [RFC PATCH v3 2/5] cpuidle: Add Cpufreq Active Stats calls tracking idle entry/exit Artem Bityutskiy
2022-04-26 15:01 ` Lukasz Luba
2022-04-26 16:29 ` Artem Bityutskiy
2022-04-27 13:58 ` Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 3/5] thermal: Add interface to cooling devices to handle governor change Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 4/5] thermal: power allocator: Prepare power actors and calm down when not used Lukasz Luba
2022-04-06 22:08 ` [RFC PATCH v3 5/5] thermal: cpufreq_cooling: Improve power estimation using Cpufreq Active Stats Lukasz Luba
2022-04-26 3:11 ` [RFC PATCH v3 0/5] Introduce " Viresh Kumar
2022-04-26 7:46 ` Lukasz Luba
2022-04-26 7:54 ` Viresh Kumar
2022-04-26 7:59 ` Lukasz Luba
2022-04-26 8:02 ` Viresh Kumar
2022-04-26 14:40 ` 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=20220406220809.22555-3-lukasz.luba@arm.com \
--to=lukasz.luba@arm.com \
--cc=amit.kachhap@gmail.com \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=dietmar.eggemann@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--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;
as well as URLs for NNTP newsgroup(s).