Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8478236rwr; Thu, 11 May 2023 01:38:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ57RIS/ml7adZpS4uweYdgOQo3cgF5ixEctq7cfsoNV3/wSD61VSHWLk/xN6rkNCWT2DjxC X-Received: by 2002:a17:90a:e00f:b0:247:19ac:9670 with SMTP id u15-20020a17090ae00f00b0024719ac9670mr20184099pjy.26.1683794327364; Thu, 11 May 2023 01:38:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683794327; cv=none; d=google.com; s=arc-20160816; b=ugvn0d7vrYpwysF2ooa13nI+mPW3PWq0ENi9OGt0JtJN5i+MXCmRQENgsGTLbbaMN9 GdoTmausdkLk+raRrXsRXkhl/ugoiRjrHTrktkpx8mp9rJOR4nn5G553SsUPIw646uxy NgMUgxMa/YrC8yGDBj0VBFN296VRh/bBgL1HfL1dF08vsO1l9c7vRXGaxKP4xdn26w/w 76KZrLWCXcNpdFxFc2u6xTIPzSL4S8QC+6fW4Enk59gBsc1eKCVsIpvSsHqW8BmqvMwf Vp0WZTbcIHnE9i0YHPRsCAdXKeLsC3EWEV6x0ApeIXiZjVDVHTzXeTv2zibXnXcheggk X/uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=wZpbxpR/RwY9sqwxsSyrWRiWe8/6Lg93oKafl0bZX8E=; b=p3StTQnsYLO8IGz4i7V0wZKF6ngoiSiXemNf5fp+eHNZ8Nvo6w1X5tiZ+MBcYtMv17 2kRQHC/FeWq5VJZyNGesm9XOEJVXRwAP7Z9QjnmkiCbyb09tkbGsUdCXR8DFwoFkP5gZ EaEca+Byy2t4gczuCmouxkN0oMleJiyipbojPmNaiVaeE8Um75qTtfnfAdY3eTe2/1BW VqGv+4oUu5V3hpS9fJMpTmlNs1Ud9OHL4dNpZRNlvm/66yCOtQDadhyrYjGZDJ8mgfsm kxQxgDLSVsCeFNlKmMjEWGfCMta2KgNs3HTasi+l7Kv/ArWd+k/rGB4+xlreEwe3Eypv gy7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Qg/LWjpB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc12-20020a17090325cc00b001ac741db80asi4061329plb.236.2023.05.11.01.38.35; Thu, 11 May 2023 01:38:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Qg/LWjpB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235696AbjEKI0C (ORCPT + 99 others); Thu, 11 May 2023 04:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234431AbjEKIZx (ORCPT ); Thu, 11 May 2023 04:25:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8472510C9; Thu, 11 May 2023 01:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=wZpbxpR/RwY9sqwxsSyrWRiWe8/6Lg93oKafl0bZX8E=; b=Qg/LWjpBqHOBF3P7TcpTYxs4F9 6JKjmU8x1TYMlI7RYZ0EtAdx6mvXg1xgmS2dk5LJp8cna5pg0yf42UXSMQXQ5481DXZC3qeLtKEXT 8KGxZAtU7p3Xf0JtELvcMjxQg2r7aE99P/jpvSa/NNbH6wbUkG94QZcioNtzZdw/KfDh9D8QMOvqv 8ICM2QQr84c1Xl5WiMR5jIsWaXA2DNnv4xRZA8u+IxU3E09XUJKihEXSdmKx4tbh47v8MhfjExx3Z /9ff6/2ug8Y3buZuATxa105RCSQaJ1jglJ9NoSvivv29PduL1m6tcCFUgos4BYvqfghkg2J4j/tVE zm7PCaWg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1px1cP-00H1wb-NZ; Thu, 11 May 2023 08:25:45 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 2343C300338; Thu, 11 May 2023 10:25:45 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 01D10235CC450; Thu, 11 May 2023 10:25:44 +0200 (CEST) Date: Thu, 11 May 2023 10:25:44 +0200 From: Peter Zijlstra To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Subject: Re: [PATCH 03/32] locking/lockdep: lockdep_set_no_check_recursion() Message-ID: <20230511082544.GS4253@hirez.programming.kicks-ass.net> References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-4-kent.overstreet@linux.dev> <20230509193147.GC2148518@hirez.programming.kicks-ass.net> <20230510085905.GJ4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 10, 2023 at 04:38:15PM -0400, Kent Overstreet wrote: > On Wed, May 10, 2023 at 10:59:05AM +0200, Peter Zijlstra wrote: > > Have you read the ww_mutex code? If not, please do so, it does similar > > things. > > > > The way it gets around the self-nesting check is by using the nest_lock > > annotation, the acquire context itself also has a dep_map for this > > purpose. > > This might work. > > I was confused for a good bit when reading tho code to figure out how > it works - nest_lock seems to be a pretty bad name, it's really not a > lock. acquire_ctx? That's just how ww_mutex uses it, the annotation itself comes from mm_take_all_locks() where mm->mmap_lock (the lock formerly known as mmap_sem) is used to serialize multi acquisition of vma locks. That is, no other code takes multiple vma locks (be it i_mmap_rwsem or anonvma->root->rwsem) in any order. These locks nest inside mmap_lock and therefore by holding mmap_lock you serialize the whole thing and can take them in any order you like. Perhaps, now, all these many years later another name would've made more sense, but I don't think it's worth the hassle of the tree-wide rename (there's a few other users since).