lkml.org 
[lkml]   [2009]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 08/19] workqueue_tracepoint: add workqueue_flush and worklet_cancel tracepoint
    Date
    From: Zhaolei <zhaolei@cn.fujitsu.com>

    Ingo Molnar <mingo@elte.hu> wrote:
    > This allows the understanding of the life cycle of a workqueue and
    > of worklets that enter that workqueue.

    [ Impact: provide finer grained details about life of worklets ]

    Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Tom Zanussi <tzanussi@gmail.com>
    Cc: Oleg Nesterov <oleg@redhat.com>,
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
    ---
    include/trace/events/workqueue.h | 36 ++++++++++++++++++++++++++++++++++++
    kernel/workqueue.c | 4 ++++
    2 files changed, 40 insertions(+), 0 deletions(-)

    diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
    index 36f4939..2e77e84 100644
    --- a/include/trace/events/workqueue.h
    +++ b/include/trace/events/workqueue.h
    @@ -76,6 +76,23 @@ TRACE_EVENT(workqueue_handler_exit,
    __entry->thread_pid, __entry->work)
    );

    +TRACE_EVENT(worklet_cancel,
    +
    + TP_PROTO(struct work_struct *work),
    +
    + TP_ARGS(work),
    +
    + TP_STRUCT__entry(
    + __field(work_func_t, func)
    + ),
    +
    + TP_fast_assign(
    + __entry->func = work->func;
    + ),
    +
    + TP_printk("func=%pF", __entry->func)
    +);
    +
    /* Trace the creation of one workqueue thread on a cpu */
    TRACE_EVENT(workqueue_creation,

    @@ -99,6 +116,25 @@ TRACE_EVENT(workqueue_creation,
    __entry->thread_pid, __entry->cpu)
    );

    +TRACE_EVENT(workqueue_flush,
    +
    + TP_PROTO(struct task_struct *wq_thread),
    +
    + TP_ARGS(wq_thread),
    +
    + TP_STRUCT__entry(
    + __array(char, thread_comm, TASK_COMM_LEN)
    + __field(pid_t, thread_pid)
    + ),
    +
    + TP_fast_assign(
    + memcpy(__entry->thread_comm, wq_thread->comm, TASK_COMM_LEN);
    + __entry->thread_pid = wq_thread->pid;
    + ),
    +
    + TP_printk("thread=%s:%d", __entry->thread_comm, __entry->thread_pid)
    +);
    +
    TRACE_EVENT(workqueue_destruction,

    TP_PROTO(struct task_struct *wq_thread),
    diff --git a/kernel/workqueue.c b/kernel/workqueue.c
    index fbcdfa2..99a81ba 100644
    --- a/kernel/workqueue.c
    +++ b/kernel/workqueue.c
    @@ -366,6 +366,8 @@ static int flush_cpu_workqueue(struct cpu_workqueue_struct *cwq)
    int active = 0;
    struct wq_barrier barr;

    + trace_workqueue_flush(cwq->thread);
    +
    WARN_ON(cwq->thread == current);

    spin_lock_irq(&cwq->lock);
    @@ -542,6 +544,8 @@ static int __cancel_work_timer(struct work_struct *work,
    {
    int ret;

    + trace_worklet_cancel(work);
    +
    do {
    ret = (timer && likely(del_timer(timer)));
    if (!ret)
    --
    1.6.2.3


    \
     
     \ /
      Last update: 2009-04-30 02:33    [W:0.024 / U:150.112 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site