lkml.org 
[lkml]   [2009]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RESEND PATCH 0/11] kernel:lockdep:replace DFS with BFS
Hi,

On Sun, Jun 28, 2009 at 11:04:35PM +0800, tom.leiming@gmail.com wrote:
> Hi,Peter
>
> Currently lockdep uses recursion DFS(depth-first search) algorithm to
> search target in checking lock circle(check_noncircular()),irq-safe
> -> irq-unsafe(check_irq_usage()) and irq inversion when adding a new
> lock dependency. This patches replace the current DFS with BFS, based on
> the following consideration:
>
> 1,no loss of efficiency, no matter DFS or BFS, the running time
> are O(V+E) (V is vertex count, and E is edge count of one
> graph);
>
> 2,BFS may be easily implemented by circular queue and consumes
> much less kernel stack space than DFS for DFS is implemented by
> recursion.



Looks like a valuable argument. check_noncircular() can be called
in very random places in the kernel where the stack may be
already deep, and this recursive DFS doesn't help there.



> 3,The shortest path can be obtained by BFS if the target is
> found, but can't be got by DFS. By the shortest path, we can
> shorten the lock dependency chain and help to troubleshoot lock
> problem easier than before.


But there I don't understand your argument.
The shortest path finding doesn't seem to me a need.
Example:

Task 1 acquires: A B C
And Later:
Task 2 acquires: C B A

DFS will probably report a circular lock dependency
with A and C.
BFS will probably report a circular lock dependency
with B and C.

Which one is the most important? Both dependencies must be fixed
anyway. Once the developer will fix one of those, the remaining one
will be reported and so on...

Or am I missing something else?



\
 
 \ /
  Last update: 2009-07-11 02:47    [W:0.195 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site