Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2173pxk; Wed, 16 Sep 2020 15:17:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNDK3S7Q19eg8J2VTfLZtuKPvIFK5fAAWG3V3j/uY131kotCWqILkXTIPBAWrIOReh6+Ko X-Received: by 2002:a05:6402:a51:: with SMTP id bt17mr16848021edb.186.1600294628995; Wed, 16 Sep 2020 15:17:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600294628; cv=none; d=google.com; s=arc-20160816; b=it1WqvBHL6iD+izTFbSCiHa80aLPMNIlofKeHPHRcNKh9ZglEBeXA5m4bs8q9tfAJw kAc1Nuo8QfkMAWELsQIncECorQ4rHSm3AQdfQW/gRRpn8C/TtlSKNFWZQ/1uhLry6b21 RfwsFe2UUiV5fC3wuroMmZ10rytdfXApArgYjSdgFz6Vu8T0aaeNEVbIaPeMETkOaFXv Z5uysWTV4XQCgmMoKF83ol5flpnD1fQCoVa5DkjV22juvKCxa52WKqdD4zFmBuGYF2eK bpaZzIWFUbKdgVdBsAUbpUZLNCnjDBpr7+PO8JWIzwTj2fRk3y6NNlb6gVX8RaGDT/HA vLPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=kpo7xwAZ6M+ZyAMOUgacMMQsd0LMITNlkn7wYNkHEHg=; b=v7Xe7spjayXfwyPEDOw35QR17SrSQ+QI2stuMfvqIGMkN/+WVKjflfi6fYofkjCz8K 0vAQT+D5IgcUlzxaH/MlN3SRRfBOjEahQx4L67y2xwb1eih+LYyqvHdS54jgHgf1+08d ASToWnggpJiaCGvb4SygWtTd67zcj0jVY+Zogm3nxZhZlrbR/y3BlynvsnpJXoNJo+qm 6thoNTT3iw1FzqFlFWj0FZo7x/8LzGkQc5iW8Gp9KoQjlneMFDfHCt7i8Wzqtp17Zuy0 sYO7HjsbBWW8zsjPxfmVpAmMyhN+xLCacaHy32gMD3x2wpiXhmFvUDOcoR42qCinceF8 R9Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S9FjfvIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k1si7463105ejj.102.2020.09.16.15.16.44; Wed, 16 Sep 2020 15:17:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S9FjfvIz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbgIPWNQ (ORCPT + 99 others); Wed, 16 Sep 2020 18:13:16 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:40394 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbgIPWNF (ORCPT ); Wed, 16 Sep 2020 18:13:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600294384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kpo7xwAZ6M+ZyAMOUgacMMQsd0LMITNlkn7wYNkHEHg=; b=S9FjfvIz1v7gkCgWORx5fnOlMzoK+OF7K4b1lNhj37xGbjBzWAyPqb0Mb6Migz876tA3mQ yDmEUWV/FdHTzCA2p8QMviYZWdB3MOiGnhFdnQ6ips/coHVB/GHBJ/7rGztA6VUkF5sbAV QuqNCTlW8kjHDTB2v4D5L6KQ3tUPrk4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-30-2-RlLNKvP9eVaFvRR19N3A-1; Wed, 16 Sep 2020 17:12:05 -0400 X-MC-Unique: 2-RlLNKvP9eVaFvRR19N3A-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 69CA81868431; Wed, 16 Sep 2020 21:12:04 +0000 (UTC) Received: from ovpn-66-86.rdu2.redhat.com (ovpn-66-86.rdu2.redhat.com [10.10.66.86]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F4CE19D61; Wed, 16 Sep 2020 21:11:59 +0000 (UTC) Message-ID: <607c446bc8d3a0cc6e96aa9792e075913ad6b2c6.camel@redhat.com> Subject: Re: [RFC v7 11/19] lockdep: Fix recursive read lock related safe->unsafe detection From: Qian Cai To: Boqun Feng Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Will Deacon , Jonathan Corbet , Waiman Long Date: Wed, 16 Sep 2020 17:11:59 -0400 In-Reply-To: <20200916161404.GD127490@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> References: <20200807074238.1632519-1-boqun.feng@gmail.com> <20200807074238.1632519-12-boqun.feng@gmail.com> <17343f6f7f2438fc376125384133c5ba70c2a681.camel@redhat.com> <20200916081046.GC127490@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> <20200916161404.GD127490@debian-boqun.qqnc3lrjykvubdpftowmye0fmh.lx.internal.cloudapp.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2020-09-17 at 00:14 +0800, Boqun Feng wrote: > Found a way to resolve this while still keeping the BFS. Every time when > we want to enqueue a lock_list, we basically enqueue a whole dep list of > entries from the previous lock_list, so we can use a trick here: instead > enqueue all the entries, we only enqueue the first entry and we can > fetch other silbing entries with list_next_or_null_rcu(). Patch as > below, I also took the chance to clear the code up and add more > comments. I could see this number (in /proc/lockdep_stats): > > max bfs queue depth: 201 > > down to (after apply this patch) > > max bfs queue depth: 61 > > with x86_64_defconfig along with lockdep and selftest configs. > > Qian, could you give it a try? It works fine as the number went down from around 3000 to 500 on our workloads.