From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932374AbeASQow (ORCPT ); Fri, 19 Jan 2018 11:44:52 -0500 Received: from merlin.infradead.org ([205.233.59.134]:56576 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932231AbeASQol (ORCPT ); Fri, 19 Jan 2018 11:44:41 -0500 Date: Fri, 19 Jan 2018 17:44:37 +0100 From: Peter Zijlstra To: yangerkun Cc: "miaoxie (A)" , "linux-kernel@vger.kernel.org" Subject: Re: Question:Lockdep Message-ID: <20180119164437.GS2228@hirez.programming.kicks-ass.net> References: <663A5575A842324DA6D21D04D5A49941F0B318@dggemm501-mbs.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <663A5575A842324DA6D21D04D5A49941F0B318@dggemm501-mbs.china.huawei.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 19, 2018 at 12:49:04PM +0000, yangerkun wrote: > Hi, > There is a problem confuses me while reading the soure code about lockdep: > If thread get a lock first time, kernel will add a hash node in chainhash_table, then > Copy and paste the lock chain and add the new one to tail. But, while checking deadlock, > I have never seen the effects about the lock chain, instead, kernel will build the > dependency graph for the checking. Does there some problems about this? I'm not sure I fully understand your question. But the purpose of the lock chain hash is to avoid work, its an optimization. If we've already observed this lock chain before (hash hit), we'll not do all the dependency checking. Without this lockdep would be terribly slow.