Subject: Make output of RT throttling more verbose
From: Carsten Emde <C.Emde@osadl.org>
Date: Tue,  9 Aug 2016 11:39:27 +0100

Make output of RT throttling more verbose.

Most of the time when a system is hit by RT throttling
activation it is evident which task is running havoc.
Sometimes, however, the culprit may be more difficult
to detect. Add some more debug output to the RT
throttling activation message for such cases.

Signed-off-by: Carsten Emde <C.Emde@osadl.org>

---
 kernel/sched/rt.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Index: linux-3.12.42-rt58/kernel/sched/rt.c
===================================================================
--- linux-3.12.42-rt58.orig/kernel/sched/rt.c
+++ linux-3.12.42-rt58/kernel/sched/rt.c
@@ -801,7 +801,8 @@ static inline int rt_se_prio(struct sche
        return rt_task_of(rt_se)->prio;
 }
 
-static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq)
+static int sched_rt_runtime_exceeded(struct rt_rq *rt_rq,
+                                    struct task_struct *curr, u64 delta_exec)
 {
        u64 runtime = sched_rt_runtime(rt_rq);
 
@@ -830,7 +831,13 @@ static int sched_rt_runtime_exceeded(str
 
                        if (!once) {
                                once = true;
-                               printk_deferred("sched: RT throttling activated\n");
+                               printk_deferred("sched: RT throttling activated"
+                                   " cmd %s cpu %d pid %d prio %d us %llu"
+                                   " flags 0x%08lx\n", curr->comm,
+                                   task_cpu(curr), task_pid_nr(curr),
+                                   MAX_RT_PRIO-1 - curr->prio,
+                                   delta_exec >> 10, (unsigned long)
+                                   task_thread_info(curr)->flags);
                        }
                } else {
                        /*
@@ -888,7 +895,7 @@ static void update_curr_rt(struct rq *rq
                if (sched_rt_runtime(rt_rq) != RUNTIME_INF) {
                        raw_spin_lock(&rt_rq->rt_runtime_lock);
                        rt_rq->rt_time += delta_exec;
-                       if (sched_rt_runtime_exceeded(rt_rq))
+                       if (sched_rt_runtime_exceeded(rt_rq, curr, delta_exec))
                                resched_task(curr);
                        raw_spin_unlock(&rt_rq->rt_runtime_lock);
                }