diff options
| author | Ming Lei <tom.leiming@gmail.com> | 2009-07-16 09:44:29 -0400 |
|---|---|---|
| committer | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-07-24 04:52:03 -0400 |
| commit | 12f3dfd022d7e616757a94f0538d3d525d806a16 (patch) | |
| tree | 22221bcfa6edcc47094bd87862eb9cc5402a5799 /kernel | |
| parent | 4dd861d6467007681991d8ec079d928db2018cbb (diff) | |
lockdep: Add statistics info for max bfs queue depth
Add BFS statistics to the existing lockdep stats.
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <1246201486-7308-10-git-send-email-tom.leiming@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/lockdep.c | 6 | ||||
| -rw-r--r-- | kernel/lockdep_internals.h | 3 | ||||
| -rw-r--r-- | kernel/lockdep_proc.c | 2 |
3 files changed, 9 insertions, 2 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 6358cf7e84b2..744da6265d99 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
| @@ -929,7 +929,7 @@ static int add_lock_to_list(struct lock_class *class, struct lock_class *this, | |||
| 929 | 929 | ||
| 930 | unsigned long bfs_accessed[BITS_TO_LONGS(MAX_LOCKDEP_ENTRIES)]; | 930 | unsigned long bfs_accessed[BITS_TO_LONGS(MAX_LOCKDEP_ENTRIES)]; |
| 931 | static struct circular_queue lock_cq; | 931 | static struct circular_queue lock_cq; |
| 932 | 932 | unsigned int max_bfs_queue_depth; | |
| 933 | static int __bfs(struct lock_list *source_entry, | 933 | static int __bfs(struct lock_list *source_entry, |
| 934 | void *data, | 934 | void *data, |
| 935 | int (*match)(struct lock_list *entry, void *data), | 935 | int (*match)(struct lock_list *entry, void *data), |
| @@ -975,6 +975,7 @@ static int __bfs(struct lock_list *source_entry, | |||
| 975 | 975 | ||
| 976 | list_for_each_entry(entry, head, entry) { | 976 | list_for_each_entry(entry, head, entry) { |
| 977 | if (!lock_accessed(entry)) { | 977 | if (!lock_accessed(entry)) { |
| 978 | unsigned int cq_depth; | ||
| 978 | mark_lock_accessed(entry, lock); | 979 | mark_lock_accessed(entry, lock); |
| 979 | if (match(entry, data)) { | 980 | if (match(entry, data)) { |
| 980 | *target_entry = entry; | 981 | *target_entry = entry; |
| @@ -986,6 +987,9 @@ static int __bfs(struct lock_list *source_entry, | |||
| 986 | ret = -1; | 987 | ret = -1; |
| 987 | goto exit; | 988 | goto exit; |
| 988 | } | 989 | } |
| 990 | cq_depth = __cq_get_elem_count(cq); | ||
| 991 | if (max_bfs_queue_depth < cq_depth) | ||
| 992 | max_bfs_queue_depth = cq_depth; | ||
| 989 | } | 993 | } |
| 990 | } | 994 | } |
| 991 | } | 995 | } |
diff --git a/kernel/lockdep_internals.h b/kernel/lockdep_internals.h index b115aaa0bf35..6baa8807efdd 100644 --- a/kernel/lockdep_internals.h +++ b/kernel/lockdep_internals.h | |||
| @@ -138,6 +138,7 @@ extern atomic_t nr_find_usage_backwards_recursions; | |||
| 138 | #endif | 138 | #endif |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | extern unsigned int max_bfs_queue_depth; | ||
| 141 | extern unsigned long nr_list_entries; | 142 | extern unsigned long nr_list_entries; |
| 142 | extern struct lock_list list_entries[MAX_LOCKDEP_ENTRIES]; | 143 | extern struct lock_list list_entries[MAX_LOCKDEP_ENTRIES]; |
| 143 | extern unsigned long bfs_accessed[]; | 144 | extern unsigned long bfs_accessed[]; |
| @@ -191,7 +192,7 @@ static inline int __cq_dequeue(struct circular_queue *cq, unsigned long *elem) | |||
| 191 | return 0; | 192 | return 0; |
| 192 | } | 193 | } |
| 193 | 194 | ||
| 194 | static inline int __cq_get_elem_count(struct circular_queue *cq) | 195 | static inline unsigned int __cq_get_elem_count(struct circular_queue *cq) |
| 195 | { | 196 | { |
| 196 | return (cq->rear - cq->front)&(MAX_CIRCULAR_QUE_SIZE-1); | 197 | return (cq->rear - cq->front)&(MAX_CIRCULAR_QUE_SIZE-1); |
| 197 | } | 198 | } |
diff --git a/kernel/lockdep_proc.c b/kernel/lockdep_proc.c index d7135aa2d2c4..9a1bf34d2ff6 100644 --- a/kernel/lockdep_proc.c +++ b/kernel/lockdep_proc.c | |||
| @@ -411,6 +411,8 @@ static int lockdep_stats_show(struct seq_file *m, void *v) | |||
| 411 | max_lockdep_depth); | 411 | max_lockdep_depth); |
| 412 | seq_printf(m, " max recursion depth: %11u\n", | 412 | seq_printf(m, " max recursion depth: %11u\n", |
| 413 | max_recursion_depth); | 413 | max_recursion_depth); |
| 414 | seq_printf(m, " max bfs queue depth: %11u\n", | ||
| 415 | max_bfs_queue_depth); | ||
| 414 | lockdep_stats_debug_show(m); | 416 | lockdep_stats_debug_show(m); |
| 415 | seq_printf(m, " debug_locks: %11u\n", | 417 | seq_printf(m, " debug_locks: %11u\n", |
| 416 | debug_locks); | 418 | debug_locks); |
