Re: Ftrace: can trace kthread?

From: Yong Zhang
Date: Thu Oct 21 2010 - 04:54:30 EST


On Thu, Oct 21, 2010 at 4:44 PM, Figo.zhang
<zhangtianfei@xxxxxxxxxxxxxxxx> wrote:
>
>> > i try by set_ftrace_pid, it also can't ftrace the kswapd.
>>
>> Are you sure kswapd got chance to run on your system?
>>
>> BTW, I can successfully trace bdi_writeback_thread,
>> # tracer: function
>> #
>> # Â Â Â Â Â TASK-PID Â ÂCPU# Â ÂTIMESTAMP ÂFUNCTION
>> # Â Â Â Â Â Â Â| | Â Â Â | Â Â Â Â Â| Â Â Â Â |
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828496: finish_task_switch <-schedule
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828498: perf_event_task_sched_in
>> <-finish_task_switch
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828498: del_timer_sync <-schedule_timeout
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828499: try_to_del_timer_sync
>> <-del_timer_sync
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828499: lock_timer_base
>> <-try_to_del_timer_sync
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828499: _spin_lock_irqsave <-lock_timer_base
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828500: _spin_unlock_irqrestore
>> <-try_to_del_timer_sync
>> Â Â Â Âflush-8:0-374 Â [000] 600743.828500: kthread_should_stop
>> <-bdi_writeback_task
>
> are you use my scprit to trace the bdi_writeback_thread ?

No.

I just
echo 0 > tracing_enabled
echo function > current_tracer
echo 374(pid of flush) > set_ftrace_pid
echo 1 > tracing_enabled
wait some time
echo 0 > tracing_enabled
cat trace

So I think this answer your question "could kthread be traced?"

Thanks,
Yong
--
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/