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 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 607E9C43331 for ; Thu, 26 Mar 2020 18:06:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2491020714 for ; Thu, 26 Mar 2020 18:06:27 +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="YzrTb7u2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2491020714 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 B05B96B000D; Thu, 26 Mar 2020 14:06:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB5B66B000E; Thu, 26 Mar 2020 14:06:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9CB126B0010; Thu, 26 Mar 2020 14:06:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0024.hostedemail.com [216.40.44.24]) by kanga.kvack.org (Postfix) with ESMTP id 849EE6B000D for ; Thu, 26 Mar 2020 14:06:26 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BA0B7180AE1AA for ; Thu, 26 Mar 2020 18:06:26 +0000 (UTC) X-FDA: 76638293172.16.door11_8f8b3673c2961 X-HE-Tag: door11_8f8b3673c2961 X-Filterd-Recvd-Size: 2966 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Mar 2020 18:06:26 +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=jWvaBwWkbMEQ4pOifwTyi245yqOSXFFRMPeorwgbLa8=; b=YzrTb7u2hy2HmIhqziABJTejXL +uLSVaAprNfSOijep16uInHeDnwFj95KZiWAYicQCGd0OTt16VpgXpjiCFCjZttimcqvGCBYfbPCY nV9WaoqBo5pqSQMD1TN/XYo1Al7aFUKqh8uwNyZzpQdkROmwmylAU2Zv1WrSqoafnoPYQkuU8+ZTe 4McrZg5OHeJexK3F3MPHN35gdfCszH+StKSnEt+T7pt4zIWtlVWiv+Y3FnwXHdKwU2DEp4zmHdKd9 NkGGvAh/gQX580/s5GPsIiaq3108sNATAVKShJtkAbb6H/63UqP8JthamgibP4AvMIcRP0BEBfIgL sLvGJK1A==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jHWtZ-0006VX-Ep; Thu, 26 Mar 2020 18:06:21 +0000 Date: Thu, 26 Mar 2020 11:06:21 -0700 From: Matthew Wilcox To: Jason Gunthorpe Cc: Michel Lespinasse , Andrew Morton , linux-mm , LKML , Peter Zijlstra , Laurent Dufour , Vlastimil Babka , Liam Howlett , Jerome Glisse , Davidlohr Bueso , David Rientjes , Hugh Dickins , Ying Han Subject: Re: [PATCH 1/8] mmap locking API: initial implementation as rwsem wrappers Message-ID: <20200326180621.GK22483@bombadil.infradead.org> References: <20200326070236.235835-1-walken@google.com> <20200326070236.235835-2-walken@google.com> <20200326175644.GN20941@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200326175644.GN20941@ziepe.ca> 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 Thu, Mar 26, 2020 at 02:56:44PM -0300, Jason Gunthorpe wrote: > On Thu, Mar 26, 2020 at 12:02:29AM -0700, Michel Lespinasse wrote: > > > +static inline bool mmap_is_locked(struct mm_struct *mm) > > +{ > > + return rwsem_is_locked(&mm->mmap_sem) != 0; > > +} > > I've been wondering if the various VM_BUG(rwsem_is_locked()) would be > better as lockdep expressions? Certainly when lockdep is enabled it > should be preferred, IMHO. > > So, I think if inlines are to be introduced this should be something > similar to netdev's ASSERT_RTNL which seems to have worked well. > > Maybe ASSERT_MMAP_SEM_READ/WRITE/HELD() and do the VM_BUG or > lockdep_is_held as appropriate? I'd rather see lockdep_assert_held() used directly rather than have a wrapper. This API includes options to check for it beind explicitly held for read/write/any, which should be useful.