aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-10-17 03:09:28 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-17 11:18:42 -0400
commitca268c691de95612981b93e58899c1d73fdb6b47 (patch)
tree5bffd6512113613ae9c3dfd0e8b19a14d8e64856 /kernel
parent623a43952abfad2d48f287d1fab07b2089d07554 (diff)
[PATCH] lockdep: increase max allowed recursion depth
In general, lockdep warnings are intended to be non-fatal, so I have put in various practical limits on internal data structure failure modes. We haven't had a /single/ lockdep-internal crash ever since lockdep went upstream [the unwinder crashes are outside of lockdep], and that's largely due to the good internal checks it does. Recursion within the dependency graph is currently limited to 20, that's probably not enough on some many-CPU boxes - this patch doubles it to 40. I have written the lockdep functions to have as small stackframes as possible, so 40 should be OK too. (The practical recursion limit should be somewhere between 100 and 200 entries. If we hit that then I'll change the algorithm to be iteration-based. Graph walking logic is so easy to program via recursion, so i'd like to keep recursion as long as possible.) Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/lockdep.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 805a322a5655..d1a3b2cfe4a9 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -575,6 +575,8 @@ static noinline int print_circular_bug_tail(void)
575 return 0; 575 return 0;
576} 576}
577 577
578#define RECURSION_LIMIT 40
579
578static int noinline print_infinite_recursion_bug(void) 580static int noinline print_infinite_recursion_bug(void)
579{ 581{
580 __raw_spin_unlock(&hash_lock); 582 __raw_spin_unlock(&hash_lock);
@@ -595,7 +597,7 @@ check_noncircular(struct lock_class *source, unsigned int depth)
595 debug_atomic_inc(&nr_cyclic_check_recursions); 597 debug_atomic_inc(&nr_cyclic_check_recursions);
596 if (depth > max_recursion_depth) 598 if (depth > max_recursion_depth)
597 max_recursion_depth = depth; 599 max_recursion_depth = depth;
598 if (depth >= 20) 600 if (depth >= RECURSION_LIMIT)
599 return print_infinite_recursion_bug(); 601 return print_infinite_recursion_bug();
600 /* 602 /*
601 * Check this lock's dependency list: 603 * Check this lock's dependency list:
@@ -645,7 +647,7 @@ find_usage_forwards(struct lock_class *source, unsigned int depth)
645 647
646 if (depth > max_recursion_depth) 648 if (depth > max_recursion_depth)
647 max_recursion_depth = depth; 649 max_recursion_depth = depth;
648 if (depth >= 20) 650 if (depth >= RECURSION_LIMIT)
649 return print_infinite_recursion_bug(); 651 return print_infinite_recursion_bug();
650 652
651 debug_atomic_inc(&nr_find_usage_forwards_checks); 653 debug_atomic_inc(&nr_find_usage_forwards_checks);
@@ -684,7 +686,7 @@ find_usage_backwards(struct lock_class *source, unsigned int depth)
684 686
685 if (depth > max_recursion_depth) 687 if (depth > max_recursion_depth)
686 max_recursion_depth = depth; 688 max_recursion_depth = depth;
687 if (depth >= 20) 689 if (depth >= RECURSION_LIMIT)
688 return print_infinite_recursion_bug(); 690 return print_infinite_recursion_bug();
689 691
690 debug_atomic_inc(&nr_find_usage_backwards_checks); 692 debug_atomic_inc(&nr_find_usage_backwards_checks);