]> git.baikalelectronics.ru Git - kernel.git/commit
tracing/bkl: Add bkl ftrace events
authorFrederic Weisbecker <fweisbec@gmail.com>
Fri, 31 Jul 2009 23:34:24 +0000 (01:34 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Thu, 24 Sep 2009 13:16:31 +0000 (15:16 +0200)
commit4917e42cd0bb7c5a66ae4e02bb71c1cc2448dcca
tree6e24c17c603268c097069000883b83bc51b4d112
parent7cd5e38470b2aab91775a0eb58fe69b23d7624b5
tracing/bkl: Add bkl ftrace events

Add two events lock_kernel and unlock_kernel() to trace the bkl uses.
This opens the door for userspace tools to perform statistics about
the callsites that use it, dependencies with other locks (by pairing
the trace with lock events), use with recursivity and so on...

The {__reacquire,release}_kernel_lock() events are not traced because
these are called from schedule, thus the sched events are sufficient
to trace them.

Example of a trace:

hald-addon-stor-4152  [000]   165.875501: unlock_kernel: depth: 0, fs/block_dev.c:1358 __blkdev_put()
hald-addon-stor-4152  [000]   167.832974: lock_kernel: depth: 0, fs/block_dev.c:1167 __blkdev_get()

How to get the callsites that acquire it recursively:

cd /debug/tracing/events/bkl
echo "lock_depth > 0" > filter

firefox-4951  [001]   206.276967: unlock_kernel: depth: 1, fs/reiserfs/super.c:575 reiserfs_dirty_inode()

You can also filter by file and/or line.

v2: Use of FILTER_PTR_STRING attribute for files and lines fields to
    make them traceable.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
include/linux/smp_lock.h
include/trace/events/bkl.h [new file with mode: 0644]
lib/kernel_lock.c