From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3961CC2BA17 for ; Mon, 6 Apr 2020 15:58:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EE9AD248E7 for ; Mon, 6 Apr 2020 15:58:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AnUm6pCT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EE9AD248E7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 743348E003D; Mon, 6 Apr 2020 11:58:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F2638E000D; Mon, 6 Apr 2020 11:58:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62F378E003D; Mon, 6 Apr 2020 11:58:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 49B368E000D for ; Mon, 6 Apr 2020 11:58:43 -0400 (EDT) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id EEA1D80160B8 for ; Mon, 6 Apr 2020 15:58:42 +0000 (UTC) X-FDA: 76677888084.09.bird74_692541d7a1422 X-HE-Tag: bird74_692541d7a1422 X-Filterd-Recvd-Size: 4343 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Apr 2020 15:58:42 +0000 (UTC) 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: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 :/