Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1202930rwe; Thu, 1 Sep 2022 14:22:34 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Y5iCw4nMj4yYVowKhwJLznSy1RtYVNpLeTSztljlur+vTky9QDN0EwqhLm/xub3pRqkX7 X-Received: by 2002:a17:906:c154:b0:733:197:a8c with SMTP id dp20-20020a170906c15400b0073301970a8cmr25451393ejc.483.1662067354615; Thu, 01 Sep 2022 14:22:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662067354; cv=none; d=google.com; s=arc-20160816; b=kZpv+t5HGHaDoS77bL5+zNIeYAZxN98YAb/BUqD7zrWQxrEN6kjH3qVTfcxNAKF/fK UX8rTYDCEVL0t7Z+kJQNjElKscxClXtMFQrDSu0djTzwDwkd1XGDiOLj/yd/qETFKyWG CAjJMDCrhAiHmENw2GgKaY+IXmeKQaSuXadov6O1xVD2IkKLmw7hv6mCOMrHzkTpRI4v M7D94k5AZt4qVqqS2KuQ5dHwoRhPiZ+zHxfEVhgdzbSI3d5GNjqWbHwFTpwPKhXYmQHm tERrqYsVGCPyVsV46L2uvvv31a6Tkqaytq3SYeDW+Qn053G9/p5bu6m3NyxASTW0hdXI UZhQ== 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=xfsb9kRgUK3KweWYt2HkB9+K5WeFFKU/t1uaMQF6e7I=; b=cFs4w/T0mhoggsiB1Qt9iMkv+G856oDiMHDSb0K3C5jur8dASO7ffx0/0zGwq5R+He QqZhLwlkbs0HgJ/tHhVTMgIitcZ/EwXfPYQtbRKA7Hl+1l6+pj4EbJ5e+rXeFEGkswh5 TUBfrmWDLfBHd8Nria8TJW7A4eBnkxOJs2lDlWmPH+Ug3PbsX5mg1rgdl407fUJkfcIn sLEQQjpuAmb2uUqZchOfY3YS0yty0ivK/tHDaugvL9qxx2tesX3qNO8j1XlJY5dZTYSo 3DZZILabSNRB8rT10jkFvfvt7MFzGG9Q48CCCRNHl+XmMZE5f05pYSFKxWyTgP7sGvji pfwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=EwoBt2tu; 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 xg6-20020a170907320600b007417a7433b4si198516ejb.658.2022.09.01.14.22.09; Thu, 01 Sep 2022 14:22:34 -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=EwoBt2tu; 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 S234245AbiIAUYU (ORCPT + 99 others); Thu, 1 Sep 2022 16:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232088AbiIAUYS (ORCPT ); Thu, 1 Sep 2022 16:24:18 -0400 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81D7971984 for ; Thu, 1 Sep 2022 13:24:17 -0700 (PDT) Date: Thu, 1 Sep 2022 16:24:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1662063855; 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=xfsb9kRgUK3KweWYt2HkB9+K5WeFFKU/t1uaMQF6e7I=; b=EwoBt2tuIDzQpe0zDHZ4K8qS5db1PANOADoqffcU8P+/iVkNHTp86cWX3pwvwa2DFgQh5u Im6eJ+7gJM+y5opnx9fMMXpn/S+nGT9mGCUCLrWd0i2piG4AffrFRXWQQJY9/vf9181j3j tibjRQQp8XEaq3ZiXDdiK1JVzP09b80= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Suren Baghdasaryan Cc: akpm@linux-foundation.org, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, paulmck@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, kernel-team@android.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions Message-ID: <20220901202409.e2fqegqghlijkzey@moria.home.lan> References: <20220901173516.702122-1-surenb@google.com> <20220901173516.702122-5-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220901173516.702122-5-surenb@google.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,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 Thu, Sep 01, 2022 at 10:34:52AM -0700, Suren Baghdasaryan wrote: > Move mmap_lock assert function definitions up so that they can be used > by other mmap_lock routines. > > Signed-off-by: Suren Baghdasaryan > --- > include/linux/mmap_lock.h | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h > index 96e113e23d04..e49ba91bb1f0 100644 > --- a/include/linux/mmap_lock.h > +++ b/include/linux/mmap_lock.h > @@ -60,6 +60,18 @@ static inline void __mmap_lock_trace_released(struct mm_struct *mm, bool write) > > #endif /* CONFIG_TRACING */ > > +static inline void mmap_assert_locked(struct mm_struct *mm) > +{ > + lockdep_assert_held(&mm->mmap_lock); > + VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm); These look redundant to me - maybe there's a reason the VM developers want both, but I would drop the VM_BUG_ON() and just keep the lockdep_assert_held(), since that's the standard way to write that assertion.