aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Lelli <juri.lelli@arm.com>2015-04-30 17:35:23 +0100
committerPunit Agrawal <punit.agrawal@arm.com>2016-03-21 14:57:43 +0000
commitd4ba5dad7e722c9b89f8a13efd746b291b85f1c0 (patch)
treec644785938adcd2f683fbba00c4dea3847f764fe
parentd39b657251494af6718b38aa0e5343b499cd6459 (diff)
DEBUG: sched,cpufreq: add cpu_capacity change tracepoint
This is useful when we want to compare cpu utilization and cpu curr capacity side by side. Signed-off-by: Juri Lelli <juri.lelli@arm.com>
-rw-r--r--drivers/cpufreq/cpufreq.c4
-rw-r--r--include/linux/sched.h2
-rw-r--r--include/trace/events/power.h7
-rw-r--r--kernel/sched/fair.c11
-rw-r--r--kernel/sched/sched.h11
5 files changed, 24 insertions, 11 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 5ca8e9517aae..0f30d11fb528 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -29,6 +29,7 @@
#include <linux/suspend.h>
#include <linux/syscore_ops.h>
#include <linux/tick.h>
+#include <linux/sched.h>
#include <trace/events/power.h>
static LIST_HEAD(cpufreq_policy_list);
@@ -473,6 +474,7 @@ static void cpufreq_notify_post_transition(struct cpufreq_policy *policy,
void cpufreq_freq_transition_begin(struct cpufreq_policy *policy,
struct cpufreq_freqs *freqs)
{
+ int cpu;
/*
* Catch double invocations of _begin() which lead to self-deadlock.
@@ -501,6 +503,8 @@ wait:
spin_unlock(&policy->transition_lock);
scale_freq_capacity(policy, freqs);
+ for_each_cpu(cpu, policy->cpus)
+ trace_cpu_capacity(capacity_curr_of(cpu), cpu);
cpufreq_notify_transition(policy, freqs, CPUFREQ_PRECHANGE);
}
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 38f082659ba6..1456269f8d40 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1047,6 +1047,8 @@ struct sched_group_energy {
struct capacity_state *cap_states; /* ptr to capacity state array */
};
+unsigned long capacity_curr_of(int cpu);
+
struct sched_group;
struct sched_domain {
diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index 284244ebfe8d..f4be04e44252 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h
@@ -120,6 +120,13 @@ DEFINE_EVENT(cpu, cpu_frequency,
TP_ARGS(frequency, cpu_id)
);
+DEFINE_EVENT(cpu, cpu_capacity,
+
+ TP_PROTO(unsigned int capacity, unsigned int cpu_id),
+
+ TP_ARGS(capacity, cpu_id)
+);
+
TRACE_EVENT(device_pm_callback_start,
TP_PROTO(struct device *dev, const char *pm_ops, int event),
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b5ea9ec335d8..9b74b86aba3a 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4698,6 +4698,17 @@ static long effective_load(struct task_group *tg, int cpu, long wl, long wg)
#endif
+/*
+ * Returns the current capacity of cpu after applying both
+ * cpu and freq scaling.
+ */
+unsigned long capacity_curr_of(int cpu)
+{
+ return cpu_rq(cpu)->cpu_capacity_orig *
+ arch_scale_freq_capacity(NULL, cpu)
+ >> SCHED_CAPACITY_SHIFT;
+}
+
static inline bool energy_aware(void)
{
return sched_feat(ENERGY_AWARE);
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 983c132af11b..db3f3db9849c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -1512,17 +1512,6 @@ static inline unsigned long cpu_util(int cpu)
return __cpu_util(cpu, 0);
}
-/*
- * Returns the current capacity of cpu after applying both
- * cpu and freq scaling.
- */
-static inline unsigned long capacity_curr_of(int cpu)
-{
- return cpu_rq(cpu)->cpu_capacity_orig *
- arch_scale_freq_capacity(NULL, cpu)
- >> SCHED_CAPACITY_SHIFT;
-}
-
#endif
#ifdef CONFIG_CPU_FREQ_GOV_SCHED