Skip to content

Commit

Permalink
trace: separate out rt tasks from wakeup tracer
Browse files Browse the repository at this point in the history
Impact: add option to trace all tasks or just RT tasks

The current wakeup tracer only traces RT task wakeups. This is
fine for those interested in wake up timings of RT tasks, but
it is useless for those that are interested in the causes
of long wakeups for non RT tasks.

This patch creates a "wakeup_rt" to implement the tracing of just
RT tasks (as the current "wakeup" does). And makes "wakeup" now
trace all tasks as an average developer would expect.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Jan 22, 2009
1 parent 97b17ef commit 3244351
Showing 1 changed file with 32 additions and 2 deletions.
34 changes: 32 additions & 2 deletions kernel/trace/trace_sched_wakeup.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static int __read_mostly tracer_enabled;
static struct task_struct *wakeup_task;
static int wakeup_cpu;
static unsigned wakeup_prio = -1;
static int wakeup_rt;

static raw_spinlock_t wakeup_lock =
(raw_spinlock_t)__RAW_SPIN_LOCK_UNLOCKED;
Expand Down Expand Up @@ -224,7 +225,7 @@ probe_wakeup(struct rq *rq, struct task_struct *p, int success)
tracing_record_cmdline(p);
tracing_record_cmdline(current);

if (likely(!rt_task(p)) ||
if ((wakeup_rt && !rt_task(p)) ||
p->prio >= wakeup_prio ||
p->prio >= current->prio)
return;
Expand Down Expand Up @@ -321,14 +322,26 @@ static void stop_wakeup_tracer(struct trace_array *tr)
unregister_trace_sched_wakeup(probe_wakeup);
}

static int wakeup_tracer_init(struct trace_array *tr)
static int __wakeup_tracer_init(struct trace_array *tr)
{
tracing_max_latency = 0;
wakeup_trace = tr;
start_wakeup_tracer(tr);
return 0;
}

static int wakeup_tracer_init(struct trace_array *tr)
{
wakeup_rt = 0;
return __wakeup_tracer_init(tr);
}

static int wakeup_rt_tracer_init(struct trace_array *tr)
{
wakeup_rt = 1;
return __wakeup_tracer_init(tr);
}

static void wakeup_tracer_reset(struct trace_array *tr)
{
stop_wakeup_tracer(tr);
Expand Down Expand Up @@ -360,6 +373,19 @@ static struct tracer wakeup_tracer __read_mostly =
#endif
};

static struct tracer wakeup_rt_tracer __read_mostly =
{
.name = "wakeup_rt",
.init = wakeup_rt_tracer_init,
.reset = wakeup_tracer_reset,
.start = wakeup_tracer_start,
.stop = wakeup_tracer_stop,
.print_max = 1,
#ifdef CONFIG_FTRACE_SELFTEST
.selftest = trace_selftest_startup_wakeup,
#endif
};

__init static int init_wakeup_tracer(void)
{
int ret;
Expand All @@ -368,6 +394,10 @@ __init static int init_wakeup_tracer(void)
if (ret)
return ret;

ret = register_tracer(&wakeup_rt_tracer);
if (ret)
return ret;

return 0;
}
device_initcall(init_wakeup_tracer);

0 comments on commit 3244351

Please sign in to comment.