diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2007-07-19 04:49:00 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-19 13:04:49 -0400 |
commit | 96645678cd726e87ce42a0664de71e047e32bca4 (patch) | |
tree | 116f568a090414777b481e8e5d9db55f420e4335 /include/linux/lockdep.h | |
parent | 443aef0eddfa44c158d1b94ebb431a70638fcab4 (diff) |
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>
Diffstat (limited to 'include/linux/lockdep.h')
-rw-r--r-- | include/linux/lockdep.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 3d3386b88b6a..0e843bf65877 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h | |||
@@ -130,12 +130,24 @@ struct lock_time { | |||
130 | unsigned long nr; | 130 | unsigned long nr; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | enum bounce_type { | ||
134 | bounce_acquired_write, | ||
135 | bounce_acquired_read, | ||
136 | bounce_contended_write, | ||
137 | bounce_contended_read, | ||
138 | nr_bounce_types, | ||
139 | |||
140 | bounce_acquired = bounce_acquired_write, | ||
141 | bounce_contended = bounce_contended_write, | ||
142 | }; | ||
143 | |||
133 | struct lock_class_stats { | 144 | struct lock_class_stats { |
134 | unsigned long contention_point[4]; | 145 | unsigned long contention_point[4]; |
135 | struct lock_time read_waittime; | 146 | struct lock_time read_waittime; |
136 | struct lock_time write_waittime; | 147 | struct lock_time write_waittime; |
137 | struct lock_time read_holdtime; | 148 | struct lock_time read_holdtime; |
138 | struct lock_time write_holdtime; | 149 | struct lock_time write_holdtime; |
150 | unsigned long bounces[nr_bounce_types]; | ||
139 | }; | 151 | }; |
140 | 152 | ||
141 | struct lock_class_stats lock_stats(struct lock_class *class); | 153 | struct lock_class_stats lock_stats(struct lock_class *class); |
@@ -150,6 +162,9 @@ struct lockdep_map { | |||
150 | struct lock_class_key *key; | 162 | struct lock_class_key *key; |
151 | struct lock_class *class_cache; | 163 | struct lock_class *class_cache; |
152 | const char *name; | 164 | const char *name; |
165 | #ifdef CONFIG_LOCK_STAT | ||
166 | int cpu; | ||
167 | #endif | ||
153 | }; | 168 | }; |
154 | 169 | ||
155 | /* | 170 | /* |
@@ -321,8 +336,8 @@ do { \ | |||
321 | if (!try(_lock)) { \ | 336 | if (!try(_lock)) { \ |
322 | lock_contended(&(_lock)->dep_map, _RET_IP_); \ | 337 | lock_contended(&(_lock)->dep_map, _RET_IP_); \ |
323 | lock(_lock); \ | 338 | lock(_lock); \ |
324 | lock_acquired(&(_lock)->dep_map); \ | ||
325 | } \ | 339 | } \ |
340 | lock_acquired(&(_lock)->dep_map); \ | ||
326 | } while (0) | 341 | } while (0) |
327 | 342 | ||
328 | #else /* CONFIG_LOCK_STAT */ | 343 | #else /* CONFIG_LOCK_STAT */ |