Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 209703
b: refs/heads/master
c: e36c886
h: refs/heads/master
i:
  209701: 599dd69
  209699: f30e6f9
  209695: fdba08e
v: v3
  • Loading branch information
Arjan van de Ven authored and Linus Torvalds committed Aug 21, 2010
1 parent 3f708ad commit 5d17747
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69b26c7ad00fd5b6129400725e2ffb95134a0e1b
refs/heads/master: e36c886a0f9d624377977fa6cae309cfd7f362fa
62 changes: 62 additions & 0 deletions trunk/include/trace/events/workqueue.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#undef TRACE_SYSTEM
#define TRACE_SYSTEM workqueue

#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_WORKQUEUE_H

#include <linux/tracepoint.h>
#include <linux/workqueue.h>

/**
* workqueue_execute_start - called immediately before the workqueue callback
* @work: pointer to struct work_struct
*
* Allows to track workqueue execution.
*/
TRACE_EVENT(workqueue_execute_start,

TP_PROTO(struct work_struct *work),

TP_ARGS(work),

TP_STRUCT__entry(
__field( void *, work )
__field( void *, function)
),

TP_fast_assign(
__entry->work = work;
__entry->function = work->func;
),

TP_printk("work struct %p: function %pf", __entry->work, __entry->function)
);

/**
* workqueue_execute_end - called immediately before the workqueue callback
* @work: pointer to struct work_struct
*
* Allows to track workqueue execution.
*/
TRACE_EVENT(workqueue_execute_end,

TP_PROTO(struct work_struct *work),

TP_ARGS(work),

TP_STRUCT__entry(
__field( void *, work )
),

TP_fast_assign(
__entry->work = work;
),

TP_printk("work struct %p", __entry->work)
);


#endif /* _TRACE_WORKQUEUE_H */

/* This part must be outside protection */
#include <trace/define_trace.h>
9 changes: 9 additions & 0 deletions trunk/kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include <linux/lockdep.h>
#include <linux/idr.h>

#define CREATE_TRACE_POINTS
#include <trace/events/workqueue.h>

#include "workqueue_sched.h"

enum {
Expand Down Expand Up @@ -1790,7 +1793,13 @@ static void process_one_work(struct worker *worker, struct work_struct *work)
work_clear_pending(work);
lock_map_acquire(&cwq->wq->lockdep_map);
lock_map_acquire(&lockdep_map);
trace_workqueue_execute_start(work);
f(work);
/*
* While we must be careful to not use "work" after this, the trace
* point will only record its address.
*/
trace_workqueue_execute_end(work);
lock_map_release(&lockdep_map);
lock_map_release(&cwq->wq->lockdep_map);

Expand Down

0 comments on commit 5d17747

Please sign in to comment.