linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] sched/debug: Add new tracepoint to track cpu_capacity
@ 2020-08-28  9:00 vincent.donnefort
  2020-08-28 10:27 ` Qais Yousef
  2020-10-05  7:43 ` [tip: sched/core] " tip-bot2 for Vincent Donnefort
  0 siblings, 2 replies; 26+ messages in thread
From: vincent.donnefort @ 2020-08-28  9:00 UTC (permalink / raw)
  To: mingo, peterz, vincent.guittot
  Cc: linux-kernel, dietmar.eggemann, valentin.schneider, qais.yousef,
	Vincent Donnefort

From: Vincent Donnefort <vincent.donnefort@arm.com>

rq->cpu_capacity is a key element in several scheduler parts, such as EAS
task placement and load balancing. Tracking this value enables testing
and/or debugging by a toolkit.

Signed-off-by: Vincent Donnefort <vincent.donnefort@arm.com>

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 021ad7b..7e19d59 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -2055,6 +2055,7 @@ const struct sched_avg *sched_trace_rq_avg_dl(struct rq *rq);
 const struct sched_avg *sched_trace_rq_avg_irq(struct rq *rq);
 
 int sched_trace_rq_cpu(struct rq *rq);
+int sched_trace_rq_cpu_capacity(struct rq *rq);
 int sched_trace_rq_nr_running(struct rq *rq);
 
 const struct cpumask *sched_trace_rd_span(struct root_domain *rd);
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 8ab48b3..f94ddd1 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -630,6 +630,10 @@ DECLARE_TRACE(pelt_se_tp,
 	TP_PROTO(struct sched_entity *se),
 	TP_ARGS(se));
 
+DECLARE_TRACE(sched_cpu_capacity_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
 DECLARE_TRACE(sched_overutilized_tp,
 	TP_PROTO(struct root_domain *rd, bool overutilized),
 	TP_ARGS(rd, overutilized));
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 06b0a40..e468271 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -36,6 +36,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_rt_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_dl_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_irq_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(pelt_se_tp);
+EXPORT_TRACEPOINT_SYMBOL_GPL(sched_cpu_capacity_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(sched_overutilized_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_cfs_tp);
 EXPORT_TRACEPOINT_SYMBOL_GPL(sched_util_est_se_tp);
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 44f7a0b..27f4392 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8116,6 +8116,8 @@ static void update_cpu_capacity(struct sched_domain *sd, int cpu)
 		capacity = 1;
 
 	cpu_rq(cpu)->cpu_capacity = capacity;
+	trace_sched_cpu_capacity_tp(cpu_rq(cpu));
+
 	sdg->sgc->capacity = capacity;
 	sdg->sgc->min_capacity = capacity;
 	sdg->sgc->max_capacity = capacity;
@@ -11318,6 +11320,18 @@ int sched_trace_rq_cpu(struct rq *rq)
 }
 EXPORT_SYMBOL_GPL(sched_trace_rq_cpu);
 
+int sched_trace_rq_cpu_capacity(struct rq *rq)
+{
+	return rq ?
+#ifdef CONFIG_SMP
+		rq->cpu_capacity
+#else
+		SCHED_CAPACITY_SCALE
+#endif
+		: -1;
+}
+EXPORT_SYMBOL_GPL(sched_trace_rq_cpu_capacity);
+
 const struct cpumask *sched_trace_rd_span(struct root_domain *rd)
 {
 #ifdef CONFIG_SMP
-- 
2.7.4


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

end of thread, other threads:[~2021-01-11 14:09 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28  9:00 [PATCH v2] sched/debug: Add new tracepoint to track cpu_capacity vincent.donnefort
2020-08-28 10:27 ` Qais Yousef
2020-08-28 17:10   ` Dietmar Eggemann
2020-08-28 17:26     ` Qais Yousef
2020-09-02 10:44       ` Dietmar Eggemann
2020-09-02 13:54         ` Phil Auld
2020-09-07 11:02           ` Qais Yousef
2020-09-08 13:19             ` Phil Auld
2020-09-08 15:22               ` Qais Yousef
2021-01-04 18:26               ` Qais Yousef
2021-01-04 18:59                 ` Alexei Starovoitov
2021-01-05 11:38                   ` Qais Yousef
2021-01-05 16:44                     ` Alexei Starovoitov
2021-01-06 11:27                       ` Qais Yousef
2021-01-06 23:42                         ` Andrii Nakryiko
2021-01-07 11:23                           ` Qais Yousef
2021-01-11 14:04                 ` Peter Zijlstra
2021-01-11 14:08                   ` Qais Yousef
2020-09-07 10:48         ` Qais Yousef
2020-09-07 11:13           ` peterz
2020-09-07 14:51             ` Qais Yousef
2020-09-08 11:17               ` Dietmar Eggemann
2020-09-08 15:17                 ` Qais Yousef
2020-09-08 16:17                   ` Dietmar Eggemann
2021-01-04 15:18             ` Qais Yousef
2020-10-05  7:43 ` [tip: sched/core] " tip-bot2 for Vincent Donnefort

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).