Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 100526
b: refs/heads/master
c: 25b0b44
h: refs/heads/master
v: v3
  • Loading branch information
Steven Rostedt authored and Thomas Gleixner committed May 23, 2008
1 parent b1b386a commit 2e5967c
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4fcdae83cebda24b519a89d3dd976081fff1ca80
refs/heads/master: 25b0b44a1c732ccfc58095cdd8438955a0a19fff
7 changes: 6 additions & 1 deletion trunk/kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,12 @@ static unsigned map_cmdline_to_pid[SAVED_CMDLINES];
static char saved_cmdlines[SAVED_CMDLINES][TASK_COMM_LEN];
static int cmdline_idx;
static DEFINE_SPINLOCK(trace_cmdline_lock);
atomic_t trace_record_cmdline_disabled;

/* trace in all context switches */
atomic_t trace_record_cmdline_enabled __read_mostly;

/* temporary disable recording */
atomic_t trace_record_cmdline_disabled __read_mostly;

static void trace_init_cmdlines(void)
{
Expand Down
2 changes: 2 additions & 0 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ extern unsigned long nsecs_to_usecs(unsigned long nsecs);
extern unsigned long tracing_max_latency;
extern unsigned long tracing_thresh;

extern atomic_t trace_record_cmdline_enabled;

void update_max_tr(struct trace_array *tr, struct task_struct *tsk, int cpu);
void update_max_tr_single(struct trace_array *tr,
struct task_struct *tsk, int cpu);
Expand Down
2 changes: 2 additions & 0 deletions trunk/kernel/trace/trace_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ static void function_reset(struct trace_array *tr)
static void start_function_trace(struct trace_array *tr)
{
function_reset(tr);
atomic_inc(&trace_record_cmdline_enabled);
tracing_start_function_trace();
}

static void stop_function_trace(struct trace_array *tr)
{
tracing_stop_function_trace();
atomic_dec(&trace_record_cmdline_enabled);
}

static void function_trace_init(struct trace_array *tr)
Expand Down
7 changes: 5 additions & 2 deletions trunk/kernel/trace/trace_sched_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ ctx_switch_func(void *__rq, struct task_struct *prev, struct task_struct *next)
if (!tracer_enabled)
return;

tracing_record_cmdline(prev);

local_irq_save(flags);
cpu = raw_smp_processor_id();
data = tr->data[cpu];
Expand Down Expand Up @@ -73,6 +71,9 @@ void
ftrace_ctx_switch(void *__rq, struct task_struct *prev,
struct task_struct *next)
{
if (unlikely(atomic_read(&trace_record_cmdline_enabled)))
tracing_record_cmdline(prev);

/*
* If tracer_switch_func only points to the local
* switch func, it still needs the ptr passed to it.
Expand Down Expand Up @@ -134,11 +135,13 @@ static void sched_switch_reset(struct trace_array *tr)
static void start_sched_trace(struct trace_array *tr)
{
sched_switch_reset(tr);
atomic_inc(&trace_record_cmdline_enabled);
tracer_enabled = 1;
}

static void stop_sched_trace(struct trace_array *tr)
{
atomic_dec(&trace_record_cmdline_enabled);
tracer_enabled = 0;
}

Expand Down

0 comments on commit 2e5967c

Please sign in to comment.