lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d82e647a0905261730k76c0fb32v3c38deb4f17736b2@mail.gmail.com>
Date:	Wed, 27 May 2009 08:30:51 +0800
From:	Ming Lei <tom.leiming@...il.com>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	mingo@...e.hu, akpm@...ux-foundation.org,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC] kernel/lockdep: use BFS(breadth-first search) algorithm to 
	search target

2009/5/26 Peter Zijlstra <a.p.zijlstra@...llo.nl>:
> On Tue, 2009-05-26 at 21:54 +0800, Ming Lei wrote:
>> Hi,All
>>
>> 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. I plan to 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, we know kernel stack is very limited, eg. 4KB.
>>
>>       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.

Another case, there are several lock_list instances in one lock dependency graph
,which all points to one lock_class, BFS can find the one with
shortest distance,but
DFS can't.   The scenario should be common, right?

Thanks.

>>
>> Any suggestions, objections or viewpoint?
>
> Ah, replace the full cycle detection might be worth it, esp with that
> pre-allocated stack you used. Its all serialized on the graph lock
> anyway.
>
> I'm not sure about 3, though, since we search on adding a each new
> dependency we'll only ever have a choice between cycles when one new
> dependency generates two cycles at the same time. Something I think is
> rare.
>
> But yes, it wuold be nice to get rid of the current recursive algorithm
> there.
>
>



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ