diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-07-19 04:48:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:49 -0400 |
commit | 21f8ca3bf6198bd21e3c4cc820af2ccf753a6ec8 (patch) | |
tree | 858f5cf78cb849ad135a6867428c2088e41d10e5 /include | |
parent | 5b7f13bd26a0c1d394a1a1f2bb6de5130c3a3843 (diff) |
fix raw_spinlock_t vs lockdep
Use the lockdep infrastructure to track lock contention and other lock
statistics.
It tracks lock contention events, and the first four unique call-sites that
encountered contention.
It also measures lock wait-time and hold-time in nanoseconds. The minimum and
maximum times are tracked, as well as a total (which together with the number
of event can give the avg).
All statistics are done per lock class, per write (exclusive state) and per read
(shared state).
The statistics are collected per-cpu, so that the collection overhead is
minimized via having no global cachemisses.
This new lock statistics feature is independent of the lock dependency checking
traditionally done by lockdep; it just shares the lock tracking code. It is
also possible to enable both and runtime disabled either component - thereby
avoiding the O(n^2) lock chain walks for instance.
This patch:
raw_spinlock_t should not use lockdep (and doesn't) since lockdep itself
relies on it.
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/spinlock_types.h | 4 | ||||
-rw-r--r-- | include/linux/spinlock_types_up.h | 9 |
2 files changed, 3 insertions, 10 deletions
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h index 210549ba4ef4..f6a3a951b79e 100644 --- a/include/linux/spinlock_types.h +++ b/include/linux/spinlock_types.h | |||
@@ -9,14 +9,14 @@ | |||
9 | * Released under the General Public License (GPL). | 9 | * Released under the General Public License (GPL). |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/lockdep.h> | ||
13 | |||
14 | #if defined(CONFIG_SMP) | 12 | #if defined(CONFIG_SMP) |
15 | # include <asm/spinlock_types.h> | 13 | # include <asm/spinlock_types.h> |
16 | #else | 14 | #else |
17 | # include <linux/spinlock_types_up.h> | 15 | # include <linux/spinlock_types_up.h> |
18 | #endif | 16 | #endif |
19 | 17 | ||
18 | #include <linux/lockdep.h> | ||
19 | |||
20 | typedef struct { | 20 | typedef struct { |
21 | raw_spinlock_t raw_lock; | 21 | raw_spinlock_t raw_lock; |
22 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) | 22 | #if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) |
diff --git a/include/linux/spinlock_types_up.h b/include/linux/spinlock_types_up.h index 27644af20b7c..04135b0e198e 100644 --- a/include/linux/spinlock_types_up.h +++ b/include/linux/spinlock_types_up.h | |||
@@ -12,14 +12,10 @@ | |||
12 | * Released under the General Public License (GPL). | 12 | * Released under the General Public License (GPL). |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #if defined(CONFIG_DEBUG_SPINLOCK) || \ | 15 | #ifdef CONFIG_DEBUG_SPINLOCK |
16 | defined(CONFIG_DEBUG_LOCK_ALLOC) | ||
17 | 16 | ||
18 | typedef struct { | 17 | typedef struct { |
19 | volatile unsigned int slock; | 18 | volatile unsigned int slock; |
20 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
21 | struct lockdep_map dep_map; | ||
22 | #endif | ||
23 | } raw_spinlock_t; | 19 | } raw_spinlock_t; |
24 | 20 | ||
25 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } | 21 | #define __RAW_SPIN_LOCK_UNLOCKED { 1 } |
@@ -34,9 +30,6 @@ typedef struct { } raw_spinlock_t; | |||
34 | 30 | ||
35 | typedef struct { | 31 | typedef struct { |
36 | /* no debug version on UP */ | 32 | /* no debug version on UP */ |
37 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
38 | struct lockdep_map dep_map; | ||
39 | #endif | ||
40 | } raw_rwlock_t; | 33 | } raw_rwlock_t; |
41 | 34 | ||
42 | #define __RAW_RW_LOCK_UNLOCKED { } | 35 | #define __RAW_RW_LOCK_UNLOCKED { } |