lkml.org 
[lkml]   [2010]   [Oct]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[RFC][PATCH 16/22] sched: add SMP traceporints for -deadline tasks
From
Date

Add tracepoints for the events involved in -deadline task migration
(mainly push, pull and migrate-task).

Signed-off-by: Dario Faggioli <raistlin@linux.it>
---
include/trace/events/sched.h | 109 ++++++++++++++++++++++++++++++++++++++++++
kernel/sched.c | 3 +
kernel/sched_dl.c | 7 +++
3 files changed, 119 insertions(+), 0 deletions(-)
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 03baa17..f1d805f 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -475,6 +475,115 @@ TRACE_EVENT(sched_timer_dl,
);

/*
+ *
+ */
+TRACE_EVENT(sched_push_task_dl,
+
+ TP_PROTO(struct task_struct *n, u64 clock, int later_cpu),
+
+ TP_ARGS(n, clock, later_cpu),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( u64, clock )
+ __field( s64, rt )
+ __field( u64, dl )
+ __field( int, cpu )
+ __field( int, later_cpu )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, n->comm, TASK_COMM_LEN);
+ __entry->pid = n->pid;
+ __entry->clock = clock;
+ __entry->rt = n->dl.runtime;
+ __entry->dl = n->dl.deadline;
+ __entry->cpu = task_cpu(n);
+ __entry->later_cpu = later_cpu;
+ ),
+
+ TP_printk("comm=%s pid=%d rt=%Ld [ns] dl=%Lu [ns] clock=%Lu [ns] cpu=%d later_cpu=%d",
+ __entry->comm, __entry->pid, (long long)__entry->rt,
+ (unsigned long long)__entry->dl, (unsigned long long)__entry->clock,
+ __entry->cpu, __entry->later_cpu)
+);
+
+/*
+ *
+ */
+TRACE_EVENT(sched_pull_task_dl,
+
+ TP_PROTO(struct task_struct *p, u64 clock, int src_cpu),
+
+ TP_ARGS(p, clock, src_cpu),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( u64, clock )
+ __field( s64, rt )
+ __field( u64, dl )
+ __field( int, cpu )
+ __field( int, src_cpu )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->clock = clock;
+ __entry->rt = p->dl.runtime;
+ __entry->dl = p->dl.deadline;
+ __entry->cpu = task_cpu(p);
+ __entry->src_cpu = src_cpu;
+ ),
+
+ TP_printk("comm=%s pid=%d rt=%Ld [ns] dl=%Lu [ns] clock=%Lu [ns] cpu=%d later_cpu=%d",
+ __entry->comm, __entry->pid, (long long)__entry->rt,
+ (unsigned long long)__entry->dl, (unsigned long long)__entry->clock,
+ __entry->cpu, __entry->src_cpu)
+);
+
+/*
+ * Tracepoint for migrations involving -deadline tasks:
+ */
+TRACE_EVENT(sched_migrate_task_dl,
+
+ TP_PROTO(struct task_struct *p, u64 clock, int dest_cpu, u64 dclock),
+
+ TP_ARGS(p, clock, dest_cpu, dclock),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( u64, clock )
+ __field( s64, rt )
+ __field( u64, dl )
+ __field( int, orig_cpu )
+ __field( int, dest_cpu )
+ __field( u64, dclock )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->clock = clock;
+ __entry->rt = p->dl.runtime;
+ __entry->dl = p->dl.deadline;
+ __entry->orig_cpu = task_cpu(p);
+ __entry->dest_cpu = dest_cpu;
+ __entry->dclock = dclock;
+ ),
+
+ TP_printk("comm=%s pid=%d rt=%Ld [ns] dl=%Lu [ns] orig_cpu=%d orig_clock=%Lu [ns] "
+ "dest_cpu=%d dest_clock=%Lu [ns]",
+ __entry->comm, __entry->pid, (long long)__entry->rt,
+ (unsigned long long)__entry->dl, __entry->orig_cpu,
+ (unsigned long long)__entry->clock, __entry->dest_cpu,
+ (unsigned long long)__entry->dclock)
+);
+
+/*
* sched_stat tracepoints for -deadline tasks:
*/
DECLARE_EVENT_CLASS(sched_stat_template_dl,
diff --git a/kernel/sched.c b/kernel/sched.c
index 060d0c9..79cac6e 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -2235,6 +2235,9 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
#endif

trace_sched_migrate_task(p, new_cpu);
+ if (unlikely(dl_task(p)))
+ trace_sched_migrate_task_dl(p, task_rq(p)->clock,
+ new_cpu, cpu_rq(new_cpu)->clock);

if (task_cpu(p) != new_cpu) {
p->se.nr_migrations++;
diff --git a/kernel/sched_dl.c b/kernel/sched_dl.c
index 229814a..cc87949 100644
--- a/kernel/sched_dl.c
+++ b/kernel/sched_dl.c
@@ -1294,6 +1294,10 @@ retry:

/* Will lock the rq it'll find */
later_rq = find_lock_later_rq(next_task, rq);
+
+ trace_sched_push_task_dl(next_task, rq->clock,
+ later_rq ? later_rq->cpu : -1);
+
if (!later_rq) {
struct task_struct *task;

@@ -1378,6 +1382,9 @@ static int pull_dl_task(struct rq *this_rq)
goto skip;

p = pick_next_earliest_dl_task(src_rq, this_cpu);
+ if (p)
+ trace_sched_pull_task_dl(p, this_rq->clock,
+ src_rq->cpu);

/*
* We found a task to be pulled if:
--
1.7.2.3

--
<<This happens because I choose it to happen!>> (Raistlin Majere)
----------------------------------------------------------------------
Dario Faggioli, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy)
http://blog.linux.it/raistlin / raistlin@ekiga.net /
dario.faggioli@jabber.org
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2010-10-29 08:43    [from the cache]
©2003-2011 Jasper Spaans