LWN.net Logo

kernel:lockdep:replace DFS with BFS

From:  tom.leiming@gmail.com
To:  mingo@elte.hu
Subject:  [PATCH 0/8] kernel:lockdep:replace DFS with BFS
Date:  Sun, 31 May 2009 22:49:17 +0800
Message-ID:  <1243781365-26814-1-git-send-email-tom.leiming@gmail.com>
Cc:  linux-kernel@vger.kernel.org, akpm@linux-foundation.org, a.p.zijlstra@chello.nl
Archive-link:  Article, Thread


Hi,
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.

     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.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Copyright © 2009, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds