Re: [PATCH v2 0/2] ftrace: Add task_comm support for trace_event

From: Frederic Weisbecker
Date: Mon May 25 2009 - 13:01:55 EST


On Mon, May 25, 2009 at 06:45:13PM +0200, Frederic Weisbecker wrote:
> On Mon, May 25, 2009 at 04:59:26PM +0800, Zhaolei wrote:
> > * From: "Ingo Molnar" <mingo@xxxxxxx>
> > >
> > > it still fails to build:
> > >
> > > kernel/built-in.o: In function `ftrace_event_enable_disable':
> > > trace_events.c:(.text+0x4df08): undefined reference to `tracing_stop_cmdline_record'
> > > trace_events.c:(.text+0x4df1f): undefined reference to `tracing_start_cmdline_record'
> > >
> > > config attached.
> >
> > Hello, Ingo
> >
> > Thanks for your report.
> >
> > I found reason.
> > It is because CONFIG_TRACING is on(But CONFIG_FTRACE is off),
> > which compiles trace_events but leaves trace_sched_switch.
> > (It is different with problem that I fixed in v1->v2, but... sorry......)
> >
> > I have fixed it, I'll send v3 after following test:
> > 1: CONFIG_TRACING on, CONFIG_FTRACE off
> > 2: CONFIG_ENABLE_EVENT_TRACING on, CONFIG_ENABLE_CONTEXT_SWITCH_TRACER off
> > 2: CONFIG_ENABLE_EVENT_TRACING on, CONFIG_ENABLE_CONTEXT_SWITCH_TRACER on
> >
> > And RFC:
> > IMHO, trace_sched_switch should not have relationship with trace_events,
> > in other words, trace_events should run without trace_sched_switch linked.
> >
> > Can we move codes for record cmdline out of trace_sched_switch.c and put them
> > into new cmdline_record.c?
> > Then, trace_functions.c and trace_events.c will only need cmdline_record.c
>
>
> The problem is that the cmdline recording is very tight to the sched
> switch tracer. tracing_start_cmdline_record() registers the sched switch
> tracer tracepoints and use them to avoid any loss of pid to cmdline
> mapping.
>
> BTW, I have a doubt about this system.
> Isn't tracing_record_cmdline() sufficient for that?
>
> We only need to record the cmdline of the traced task, not all
> of them.
>
> No?
>


Ah I understand now.

tracing_record_cmdline() is useful for tracers that raise few traces.
It only record the cmdlines it needs and that's it.

Instead the tracing_start/stop_cmdline pair is useful when we have a lot of
traces. Then we won't call tracing_record_cmdline() dozen of times in a
single task quantum but only each time it is scheduled.

Ok.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/