linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qais Yousef <qais.yousef@arm.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org,
	Pavankumar Kondeti <pkondeti@codeaurora.org>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Uwe Kleine-Konig <u.kleine-koenig@pengutronix.de>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Quentin Perret <quentin.perret@arm.com>,
	Qais Yousef <qais.yousef@arm.com>
Subject: [PATCH v3 3/6] sched: Add new tracepoints to track pelt at rq level
Date: Tue,  4 Jun 2019 12:14:56 +0100	[thread overview]
Message-ID: <20190604111459.2862-4-qais.yousef@arm.com> (raw)
In-Reply-To: <20190604111459.2862-1-qais.yousef@arm.com>

The new tracepoints allow tracking PELT signals at rq level for all
scheduling classes + irq.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
---
 include/trace/events/sched.h | 23 +++++++++++++++++++++++
 kernel/sched/fair.c          |  6 ++++++
 kernel/sched/pelt.c          |  9 ++++++++-
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index c8c7c7efb487..520b89d384ec 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -594,6 +594,29 @@ TRACE_EVENT(sched_wake_idle_without_ipi,
 
 	TP_printk("cpu=%d", __entry->cpu)
 );
+
+/*
+ * Following tracepoints are not exported in tracefs and provide hooking
+ * mechanisms only for testing and debugging purposes.
+ *
+ * Postfixed with _tp to make them easily identifiable in the code.
+ */
+DECLARE_TRACE(pelt_cfs_tp,
+	TP_PROTO(struct cfs_rq *cfs_rq),
+	TP_ARGS(cfs_rq));
+
+DECLARE_TRACE(pelt_rt_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_dl_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
+DECLARE_TRACE(pelt_irq_tp,
+	TP_PROTO(struct rq *rq),
+	TP_ARGS(rq));
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 18c89ebadfc7..dee1338ec4a9 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3353,6 +3353,8 @@ static inline int propagate_entity_load_avg(struct sched_entity *se)
 	update_tg_cfs_util(cfs_rq, se, gcfs_rq);
 	update_tg_cfs_runnable(cfs_rq, se, gcfs_rq);
 
+	trace_pelt_cfs_tp(cfs_rq);
+
 	return 1;
 }
 
@@ -3505,6 +3507,8 @@ static void attach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, flags);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /**
@@ -3524,6 +3528,8 @@ static void detach_entity_load_avg(struct cfs_rq *cfs_rq, struct sched_entity *s
 	add_tg_cfs_propagate(cfs_rq, -se->avg.load_sum);
 
 	cfs_rq_util_change(cfs_rq, 0);
+
+	trace_pelt_cfs_tp(cfs_rq);
 }
 
 /*
diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c
index befce29bd882..c9d4945861a4 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -28,6 +28,8 @@
 #include "sched.h"
 #include "pelt.h"
 
+#include <trace/events/sched.h>
+
 /*
  * Approximate:
  *   val * y^n,    where y^32 ~= 0.5 (~1 scheduling period)
@@ -292,6 +294,7 @@ int __update_load_avg_cfs_rq(u64 now, struct cfs_rq *cfs_rq)
 				cfs_rq->curr != NULL)) {
 
 		___update_load_avg(&cfs_rq->avg, 1, 1);
+		trace_pelt_cfs_tp(cfs_rq);
 		return 1;
 	}
 
@@ -317,6 +320,7 @@ int update_rt_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_rt, 1, 1);
+		trace_pelt_rt_tp(rq);
 		return 1;
 	}
 
@@ -340,6 +344,7 @@ int update_dl_rq_load_avg(u64 now, struct rq *rq, int running)
 				running)) {
 
 		___update_load_avg(&rq->avg_dl, 1, 1);
+		trace_pelt_dl_tp(rq);
 		return 1;
 	}
 
@@ -388,8 +393,10 @@ int update_irq_load_avg(struct rq *rq, u64 running)
 				1,
 				1);
 
-	if (ret)
+	if (ret) {
 		___update_load_avg(&rq->avg_irq, 1, 1);
+		trace_pelt_irq_tp(rq);
+	}
 
 	return ret;
 }
-- 
2.17.1


  parent reply	other threads:[~2019-06-04 11:15 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 11:14 [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Qais Yousef
2019-06-04 11:14 ` [PATCH v3 1/6] sched: autogroup: Make autogroup_path() always available Qais Yousef
2019-06-25  8:24   ` [tip:sched/core] sched/autogroup: " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 2/6] sched: add a new sched_trace_*() helper functions Qais Yousef
2019-06-25  8:25   ` [tip:sched/core] sched/debug: Add " tip-bot for Qais Yousef
2019-06-04 11:14 ` Qais Yousef [this message]
2019-06-25  8:26   ` [tip:sched/core] sched/debug: Add new tracepoints to track PELT at rq level tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 4/6] sched: Add new tracepoint to track pelt at se level Qais Yousef
2019-06-25  8:27   ` [tip:sched/core] sched/debug: Add new tracepoint to track PELT " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 5/6] sched: Add sched_overutilized tracepoint Qais Yousef
2019-06-17 15:50   ` Peter Zijlstra
2019-06-17 16:31     ` Qais Yousef
2019-06-25  8:27   ` [tip:sched/core] sched/debug: " tip-bot for Qais Yousef
2019-06-04 11:14 ` [PATCH v3 6/6] sched: export the newly added tracepoints Qais Yousef
2019-06-25  8:28   ` [tip:sched/core] sched/debug: Export " tip-bot for Qais Yousef
2019-06-05  6:17 ` [PATCH v3 0/6] sched: Add new tracepoints required for EAS testing Christoph Hellwig
2019-06-05  7:22   ` Peter Zijlstra
2019-06-05 22:33   ` Qais Yousef
2019-06-17 12:51 ` Qais Yousef
2019-06-17 15:55   ` Peter Zijlstra
2019-06-17 16:22     ` Qais Yousef

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=20190604111459.2862-4-qais.yousef@arm.com \
    --to=qais.yousef@arm.com \
    --cc=bigeasy@linutronix.de \
    --cc=dietmar.eggemann@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pkondeti@codeaurora.org \
    --cc=quentin.perret@arm.com \
    --cc=rostedt@goodmis.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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).