mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Bouvier <benjamin.bouvier@nokia.com>
To: <mingo@redhat.com>, <peterz@infradead.org>
Cc: <rostedt@goodmis.org>, <u.kleine-koenig@pengutronix.de>,
	<bigeasy@linutronix.de>, <pkondeti@codeaurora.org>,
	<alexander.sverdlin@nokia.com>, <linux-kernel@vger.kernel.org>,
	Benjamin Bouvier <benjamin.bouvier@nokia.com>
Subject: [PATCH] sched/debug: Add tracepoint for RT throttling
Date: Fri, 14 Dec 2018 10:27:41 +0200	[thread overview]
Message-ID: <20181214082741.8507-1-benjamin.bouvier@nokia.com> (raw)

As there is currently no information on which RT task is throttled, add a
new tracepoint for debug purpose. By the way improve printk debugging
message by adding task name, pid and cpu for which the throttle has been
executed.

Signed-off-by: Benjamin Bouvier <benjamin.bouvier@nokia.com>
---
 include/trace/events/sched.h | 27 +++++++++++++++++++++++++++
 kernel/sched/rt.c            |  6 +++++-
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 9a4bdfadab07..09d3f7566f0a 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -587,6 +587,33 @@ TRACE_EVENT(sched_wake_idle_without_ipi,
 
 	TP_printk("cpu=%d", __entry->cpu)
 );
+
+/*
+ * Tracepoint for RT throttling task.
+ */
+TRACE_EVENT(sched_rt_throttling,
+
+	TP_PROTO(struct task_struct *tsk, int cpu),
+
+	TP_ARGS(tsk, cpu),
+
+	TP_STRUCT__entry(
+		__array(char,	comm,	TASK_COMM_LEN)
+		__field(pid_t,	pid)
+		__field(int,	cpu)
+	),
+
+	TP_fast_assign(
+		memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
+		__entry->pid	= tsk->pid;
+		__entry->cpu	= cpu;
+	),
+
+	TP_printk("comm=%s pid=%d cpu=%d",
+			__entry->comm, __entry->pid,
+			__entry->cpu)
+);
+
 #endif /* _TRACE_SCHED_H */
 
 /* This part must be outside protection */
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a21ea6021929..1a0ee91c9e16 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -6,6 +6,7 @@
 #include "sched.h"
 
 #include "pelt.h"
+#include <trace/events/sched.h>
 
 int sched_rr_timeslice = RR_TIMESLICE;
 int sysctl_sched_rr_timeslice = (MSEC_PER_SEC / HZ) * RR_TIMESLICE;
@@ -928,7 +929,10 @@ static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
 		 */
 		if (likely(rt_b->rt_runtime)) {
 			rt_rq->rt_throttled = 1;
-			printk_deferred_once("sched: RT throttling activated\n");
+			printk_deferred_once(
+				"sched: RT throttling activated for task pid %d (%s) on cpu:%d\n",
+				rt_rq->rq->curr->pid, rt_rq->rq->curr->comm, rt_rq->rq->cpu);
+			trace_sched_rt_throttling(rt_rq->rq->curr, rt_rq->rq->cpu);
 		} else {
 			/*
 			 * In case we did anyway, make it go away,
-- 
2.10.2


             reply	other threads:[~2018-12-14  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14  8:27 Benjamin Bouvier [this message]
2018-12-14  8:46 ` Sebastian Andrzej Siewior
2018-12-15 21:59 ` kbuild test robot

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=20181214082741.8507-1-benjamin.bouvier@nokia.com \
    --to=benjamin.bouvier@nokia.com \
    --cc=alexander.sverdlin@nokia.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pkondeti@codeaurora.org \
    --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

all inboxes | Powered by JetHome®