Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3441354ybb; Mon, 6 Apr 2020 09:00:39 -0700 (PDT) X-Google-Smtp-Source: APiQypJ1FNagv9cBhyuneCWlyQCFVFWS4OMJI7qnUy1J0eEnvAjKPb5PUPz5ihMw8FMYSgy6wBEc X-Received: by 2002:aca:ebc5:: with SMTP id j188mr50698oih.65.1586188839716; Mon, 06 Apr 2020 09:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586188839; cv=none; d=google.com; s=arc-20160816; b=jUY+lKsZEJLlh8NtBnu5m5YGwHPkmtJWXQqbHJpNzWJtxHPxpmRQdP38bUo6OENyOx DelGhNHV4ehYOoY3Gkv1+OYgABytq4fQfx+Hg62rwY/G3Fk2MIk0jp72kNj9iFgyvX6U sMY7Jbskdf9jsfsrubv6LJHrrslKaTaBPIYQaxveLsw2xpGLQIvJBo3DFKAQ9eRjmt08 Kf+vX1XOpKLwbgBUWQJGS2FrvXUeCFuND1RqTqyZQPRBNGgU0rMwQkeUaMIr+KewBwow mcUWIAoylEgl42IE3za0KauBNNkkdQQdXSYT/0rR6/Zk4Qh79Pb9Wb0VoEpWwi1vpIbv HEnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=ShWsL7pXWFWuGei4iTDZ8nde+Y2fk5HTQbOdKIP7vME=; b=g+3hyJF7TGy4xDMErXs46RcyysXN7JMSw+yyKJevPPGv6Rul5NA+QkE7dlZdKWYZUD wuypYZb5Omcs9ZbotQXRYduyKAh32xsQ27bbgxVGqGk+f4Z3OtjtpcMMI1/7zx/h82bw heaAgp/zS1GgUTflRQ6nmN7clum4bgEj1sIa176OtsqmsZ2Yw4zlnwIKV5a/99LmmcQ3 R6VPN1AEOfE9cLL0Dlwb41AEy7WntS15UTYeQpGuMnhcEfuVz+PvdheZ17unAElbGvHL bVCnc1DTzMwA9mSCvyTJFb7gO1QiHMlwVt9V9htOqCjhyqqJB6m6cBMCl6t72Tv5FhUl BV2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AnUm6pCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q12si7663672ooi.0.2020.04.06.09.00.25; Mon, 06 Apr 2020 09:00:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=AnUm6pCT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729245AbgDFP6u (ORCPT + 99 others); Mon, 6 Apr 2020 11:58:50 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:58818 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729202AbgDFP6u (ORCPT ); Mon, 6 Apr 2020 11:58:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=ShWsL7pXWFWuGei4iTDZ8nde+Y2fk5HTQbOdKIP7vME=; b=AnUm6pCTgZaoKjuMKOiNX/B4cW XhuMR7JnJn4ShKN18HyehJYEjjJBnawp/R6XjC3WS91zIXRAw72LwADJF1xUZv55Yx5SBNrnA1kGz P5zjq6Ra2gb0qmFg3NN1AVSHZ6JO/hQv+zeFFqHw+n5BPA+9IvB4+0CP3HlukdomrvDsXKjkhU6zi MBLOeaU0Hw+i06FTZzafS4tMsCWa6Gn+ardIF723iAgyGgv3ZeXnGtMStjF7HS97lNGPLOYVlrPcr wfDeR8NihHLg5XcSnwHRYA0uxWU/RLhRx/5fJSx5vhSTPVXSH+++ur249pcL0SHURraRpxDl/EbWe RmZVkFQA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1jLU8y-0007wl-Ry; Mon, 06 Apr 2020 15:58:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9C779306102; Mon, 6 Apr 2020 17:58:34 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 821EC2BAC77C0; Mon, 6 Apr 2020 17:58:34 +0200 (CEST) Date: Mon, 6 Apr 2020 17:58:34 +0200 From: Peter Zijlstra To: Michel Lespinasse Cc: Andrew Morton , linux-mm , LKML , Laurent Dufour , Vlastimil Babka , Matthew Wilcox , Liam Howlett , Jerome Glisse , Davidlohr Bueso , David Rientjes , Hugh Dickins , Ying Han , Jason Gunthorpe , Markus Elfring Subject: Re: [PATCH v3 06/10] mmap locking API: convert nested write lock sites Message-ID: <20200406155834.GR20730@hirez.programming.kicks-ass.net> References: <20200327225102.25061-1-walken@google.com> <20200327225102.25061-7-walken@google.com> <20200401134234.GR20696@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 06, 2020 at 08:35:03AM -0700, Michel Lespinasse wrote: > On Wed, Apr 1, 2020 at 6:42 AM Peter Zijlstra wrote: > > > > On Fri, Mar 27, 2020 at 03:50:58PM -0700, Michel Lespinasse wrote: > > > > > @@ -26,6 +31,12 @@ static inline void mmap_write_unlock(struct mm_struct *mm) > > > up_write(&mm->mmap_sem); > > > } > > > > > > +/* Pairs with mmap_write_lock_nested() */ > > > +static inline void mmap_write_unlock_nested(struct mm_struct *mm) > > > +{ > > > + up_write(&mm->mmap_sem); > > > +} > > > + > > > static inline void mmap_downgrade_write_lock(struct mm_struct *mm) > > > { > > > downgrade_write(&mm->mmap_sem); > > > > Why does unlock_nested() make sense ? > > I thought it would make things more explicit to match the nested lock > with the corresponding unlock site; however this information is not > used at the moment (i.e. the nested unlock is implemented identically > to the regular unlock). > > Having the matching sites explicitly identified may help when > implementing lock instrumentation, or when changing the lock type > (another patchset I am working on needs to pass an explicit lock range > to the nested lock and unlock sites). > > I'll admit this is not a super strong argument, and can be deferred to > when an actual need shows up in the future. The thing is, lock-acquisition order matters _a_lot_, lock-release order is irrelevant. ISTR there was a thread about this some 14 years ago, but please don't ask me to go find it :/