lockstat: measure lock bouncing
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Thu, 19 Jul 2007 08:49:00 +0000 (01:49 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 19 Jul 2007 17:04:49 +0000 (10:04 -0700)
commit96645678cd726e87ce42a0664de71e047e32bca4
tree116f568a090414777b481e8e5d9db55f420e4335
parent443aef0eddfa44c158d1b94ebb431a70638fcab4
lockstat: measure lock bouncing

    __acquire
        |
       lock _____
        |        \
        |    __contended
        |         |
        |        wait
        | _______/
        |/
        |
   __acquired
        |
   __release
        |
     unlock

We measure acquisition and contention bouncing.

This is done by recording a cpu stamp in each lock instance.

Contention bouncing requires the cpu stamp to be set on acquisition. Hence we
move __acquired into the generic path.

__acquired is then used to measure acquisition bouncing by comparing the
current cpu with the old stamp before replacing it.

__contended is used to measure contention bouncing (only useful for preemptable
locks)

[akpm@linux-foundation.org: cleanups]
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/lockdep.h
kernel/lockdep.c
kernel/lockdep_proc.c
kernel/mutex.c