Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8541077rwr; Thu, 11 May 2023 02:46:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ48OkS7ih3a0+WDfRnqNjbxGTIed/9APO0Xb+j7FT4msBvPZO2mLRj1jIy5q68T3f+5Z6iL X-Received: by 2002:a17:902:d512:b0:1ab:723:1acc with SMTP id b18-20020a170902d51200b001ab07231accmr25830718plg.35.1683798417752; Thu, 11 May 2023 02:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683798417; cv=none; d=google.com; s=arc-20160816; b=0c5mZaxnYSesa3GsEJjXNKxLU3BcohlCjAR7X4awnL3H1FUj7DINLukSwmhz+OGhf0 bHvOobveORQxOjS0BAO9qf50PvL4hHZQr9kBvmlA/UCBJ2N7OFHAc6xkS52snkVz1DWO BkI0kPWSTxzzYY+QlYLFVykQxLkFEFd/k6RMkE3TRTQ3wViIS0CiiziL4gqFEugSAV4l OL0enHyNOgmesPnAv84SuCs3jDq61JkHqvWa14G2+P43ZDDiOlQ/4McR40RGcEqPVGqb wRkoT6pFOfd4fpenvs3SOUWel/v9uw8ASkh5BPynTsyXkSSUyTe7M4oimByLW8mhtEN+ nZSg== 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:dkim-signature:date; bh=xnpK2EQat/Ff2KEBV71odomLn6KPTIV5+P/7fITBQhY=; b=HT5oOqaF4wAuWX1VHGtPZZv3DuFs7DKDHHMgXRaTettsiiFAd3nCkcQ8MjNB0gMYMl bhdYX20HJ4d2kzvztgoD1tHG3BrlMVwnPt6Ybfv4k71xwJvMPYPG+sVMexAQWRiSG9vZ VA0fzm01/fvCfP43cMFSrIkBuRZYmO+S0dL1J05aAPYLbLNpslBuxONJqJTZgWYbaWzQ UTq78GfcmZm8r9zx7CozZJL7NfR892SLIdcFvXfUgPdMLGU9LapxHfEm4EEfeTCp46mQ SW4qhG+FUmE69XfTKG7C2exsx7Ljpokxit5xI92FQ4PW9z+1M4Lyu0xKczQH1x4p/1K1 CSxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Ey1KdQot; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a1-20020a170902ecc100b001ac2ff9fbf8si6603552plh.403.2023.05.11.02.46.43; Thu, 11 May 2023 02:46:57 -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=@linux.dev header.s=key1 header.b=Ey1KdQot; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237519AbjEKJcj (ORCPT + 99 others); Thu, 11 May 2023 05:32:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235589AbjEKJcf (ORCPT ); Thu, 11 May 2023 05:32:35 -0400 Received: from out-13.mta0.migadu.com (out-13.mta0.migadu.com [IPv6:2001:41d0:1004:224b::d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E0385BB2 for ; Thu, 11 May 2023 02:32:31 -0700 (PDT) Date: Thu, 11 May 2023 05:32:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683797547; 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: in-reply-to:in-reply-to:references:references; bh=xnpK2EQat/Ff2KEBV71odomLn6KPTIV5+P/7fITBQhY=; b=Ey1KdQotjaQR2+EzlA3MPQ6M81s96sZA66yvMsBaAI0FOSARyHtWvwB74GkAYD0TCcGKGs 2VRZPsWRDRjhqsYegKW+MmI4fxDbjfM/uF+K/eFWRmXuBcaZG/40kxbelv4JGCe7lb1EKL w1dq9zwbGcMCiskQgaydjx+yPpKhpG8= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Peter Zijlstra 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: 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> <20230511082544.GS4253@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230511082544.GS4253@hirez.programming.kicks-ass.net> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Thu, May 11, 2023 at 10:25:44AM +0200, Peter Zijlstra wrote: > 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). Thanks for the history lesson :)