diff options
author | Yuyang Du <duyuyang@gmail.com> | 2019-05-06 04:19:31 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-06-03 05:55:47 -0400 |
commit | 154f185e9c0f6c50ac8e901630e14aa5b36f9414 (patch) | |
tree | 34f48bb7435dbb70f5ff2d880018abe3fb87f4bb /kernel/locking | |
parent | 77a806922cfdebcf3ae89d31a8b592a7f7fbe537 (diff) |
locking/lockdep: Update comments on dependency search
The breadth-first search is implemented as flat-out non-recursive now, but
the comments are still describing it as recursive, update the comments in
that regard.
Signed-off-by: Yuyang Du <duyuyang@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: bvanassche@acm.org
Cc: frederic@kernel.org
Cc: ming.lei@redhat.com
Cc: will.deacon@arm.com
Link: https://lkml.kernel.org/r/20190506081939.74287-16-duyuyang@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/locking')
-rw-r--r-- | kernel/locking/lockdep.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 2e8ef6082f72..b2ca20aa69aa 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c | |||
@@ -1381,6 +1381,10 @@ static inline struct list_head *get_dep_list(struct lock_list *lock, int offset) | |||
1381 | return lock_class + offset; | 1381 | return lock_class + offset; |
1382 | } | 1382 | } |
1383 | 1383 | ||
1384 | /* | ||
1385 | * Forward- or backward-dependency search, used for both circular dependency | ||
1386 | * checking and hardirq-unsafe/softirq-unsafe checking. | ||
1387 | */ | ||
1384 | static int __bfs(struct lock_list *source_entry, | 1388 | static int __bfs(struct lock_list *source_entry, |
1385 | void *data, | 1389 | void *data, |
1386 | int (*match)(struct lock_list *entry, void *data), | 1390 | int (*match)(struct lock_list *entry, void *data), |
@@ -1461,12 +1465,6 @@ static inline int __bfs_backwards(struct lock_list *src_entry, | |||
1461 | 1465 | ||
1462 | } | 1466 | } |
1463 | 1467 | ||
1464 | /* | ||
1465 | * Recursive, forwards-direction lock-dependency checking, used for | ||
1466 | * both noncyclic checking and for hardirq-unsafe/softirq-unsafe | ||
1467 | * checking. | ||
1468 | */ | ||
1469 | |||
1470 | static void print_lock_trace(struct lock_trace *trace, unsigned int spaces) | 1468 | static void print_lock_trace(struct lock_trace *trace, unsigned int spaces) |
1471 | { | 1469 | { |
1472 | unsigned long *entries = stack_trace + trace->offset; | 1470 | unsigned long *entries = stack_trace + trace->offset; |
@@ -2285,7 +2283,7 @@ check_deadlock(struct task_struct *curr, struct held_lock *next, int read) | |||
2285 | 2283 | ||
2286 | /* | 2284 | /* |
2287 | * There was a chain-cache miss, and we are about to add a new dependency | 2285 | * There was a chain-cache miss, and we are about to add a new dependency |
2288 | * to a previous lock. We recursively validate the following rules: | 2286 | * to a previous lock. We validate the following rules: |
2289 | * | 2287 | * |
2290 | * - would the adding of the <prev> -> <next> dependency create a | 2288 | * - would the adding of the <prev> -> <next> dependency create a |
2291 | * circular dependency in the graph? [== circular deadlock] | 2289 | * circular dependency in the graph? [== circular deadlock] |
@@ -2335,11 +2333,12 @@ check_prev_add(struct task_struct *curr, struct held_lock *prev, | |||
2335 | /* | 2333 | /* |
2336 | * Prove that the new <prev> -> <next> dependency would not | 2334 | * Prove that the new <prev> -> <next> dependency would not |
2337 | * create a circular dependency in the graph. (We do this by | 2335 | * create a circular dependency in the graph. (We do this by |
2338 | * forward-recursing into the graph starting at <next>, and | 2336 | * a breadth-first search into the graph starting at <next>, |
2339 | * checking whether we can reach <prev>.) | 2337 | * and check whether we can reach <prev>.) |
2340 | * | 2338 | * |
2341 | * We are using global variables to control the recursion, to | 2339 | * The search is limited by the size of the circular queue (i.e., |
2342 | * keep the stackframe size of the recursive functions low: | 2340 | * MAX_CIRCULAR_QUEUE_SIZE) which keeps track of a breadth of nodes |
2341 | * in the graph whose neighbours are to be checked. | ||
2343 | */ | 2342 | */ |
2344 | this.class = hlock_class(next); | 2343 | this.class = hlock_class(next); |
2345 | this.parent = NULL; | 2344 | this.parent = NULL; |