diff options
author | Jarek Poplawski <jarkao2@o2.pl> | 2007-03-22 04:11:28 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-03-22 22:39:06 -0400 |
commit | 9c35dd7f8bda1849dcb430be99325504221048df (patch) | |
tree | 0c1d8eef5af9e21bf9c552f13646710f57b97f23 /kernel | |
parent | b43376927ab0f7b64c4fb304568ecfaea10446e2 (diff) |
[PATCH] lockdep: debug_show_all_locks & debug_show_held_locks vs. debug_locks
lockdep's data shouldn't be used when debug_locks == 0 because it's not
updated after this, so it's more misleading than helpful.
PS: probably lockdep's current-> fields should be reset after it turns
debug_locks off: so, after printing a bug report, but before return from
exported functions, but there are really a lot of these possibilities (e.g.
after DEBUG_LOCKS_WARN_ON), so, something could be missed. (Of course
direct use of this fields isn't recommended either.)
Reported-by: Folkert van Heusden <folkert@vanheusden.com>
Inspired-by: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Jarek Poplawski <jarkao2@o2.pl>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: 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 'kernel')
-rw-r--r-- | kernel/lockdep.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 8dc24c92dc6d..7065a687ac54 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -2742,6 +2742,10 @@ void debug_show_all_locks(void) | |||
2742 | int count = 10; | 2742 | int count = 10; |
2743 | int unlock = 1; | 2743 | int unlock = 1; |
2744 | 2744 | ||
2745 | if (unlikely(!debug_locks)) { | ||
2746 | printk("INFO: lockdep is turned off.\n"); | ||
2747 | return; | ||
2748 | } | ||
2745 | printk("\nShowing all locks held in the system:\n"); | 2749 | printk("\nShowing all locks held in the system:\n"); |
2746 | 2750 | ||
2747 | /* | 2751 | /* |
@@ -2785,6 +2789,10 @@ EXPORT_SYMBOL_GPL(debug_show_all_locks); | |||
2785 | 2789 | ||
2786 | void debug_show_held_locks(struct task_struct *task) | 2790 | void debug_show_held_locks(struct task_struct *task) |
2787 | { | 2791 | { |
2792 | if (unlikely(!debug_locks)) { | ||
2793 | printk("INFO: lockdep is turned off.\n"); | ||
2794 | return; | ||
2795 | } | ||
2788 | lockdep_print_held_locks(task); | 2796 | lockdep_print_held_locks(task); |
2789 | } | 2797 | } |
2790 | 2798 | ||