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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FB07ECAAD3 for ; Thu, 1 Sep 2022 23:22:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 89F8A8007F; Thu, 1 Sep 2022 19:21:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 84F1D8000D; Thu, 1 Sep 2022 19:21:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 716A38007F; Thu, 1 Sep 2022 19:21:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 614B98000D for ; Thu, 1 Sep 2022 19:21:59 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 35A4A1606E0 for ; Thu, 1 Sep 2022 23:21:59 +0000 (UTC) X-FDA: 79865091558.10.742D112 Received: from mail-yb1-f177.google.com (mail-yb1-f177.google.com [209.85.219.177]) by imf08.hostedemail.com (Postfix) with ESMTP id DFE7A160059 for ; Thu, 1 Sep 2022 23:21:58 +0000 (UTC) Received: by mail-yb1-f177.google.com with SMTP id 123so909413ybv.7 for ; Thu, 01 Sep 2022 16:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date; bh=TioOqS04vLMS9dH6wDVg3ppqoyZpw4Z0vjZr4LO/zFY=; b=k1eQ5hiUMMNou7qBsVIMH8lkkFwkk+vgtWYh7f5ywTcVo9hlj63v9Ohlnl7I4aVQn2 GKNc7kz9DNkTzlzJbs7rNIACNJQpgSFtXp8ekBVwDboxc58Q20On8g/7Ml1oAOUn3Ce3 IJSbUJRUZjtXcBEog461xSrYM2HF3AP0QXjTmMrynLxxaUM0Lx3J39/DOYaC4rORcZFC Ml9yPqd6Al8pgH5yjdE3x7J31KSa7Vqb3x9q5k1HdwNRFhURAjgmW5h3DEC9e1sDnxzz uX3CPfe0M1qBUQSu4yJNm4/ICa2gO5smYoiREDCRbhjpvjuH1N0756ewgER3fFa+YmzK VKXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date; bh=TioOqS04vLMS9dH6wDVg3ppqoyZpw4Z0vjZr4LO/zFY=; b=6JFqHw0GgcrZ68J6flzjjy+8GXZXmWTR4njI/84JV7sriMp4MCW8l/ocMH4ugICPF1 PQmQzEZ8FFAkMcAedOsX0F0rbbzW2aKvai/t/3VAxtbe9wsKCPeyjK+/9W2Lgdc2r9Dm 4yqEbdNVR2e1JyDm6WFOx3mWr7ZD42FivR+gjpTIy60Z19YangR/n3UMbjD83CRQgRER CD1ULWnfMYZdr67+288qfZUT0fSqGShSrGfQcfkgXmaZd5T5MVteY5pkmg9RedRbPH7R ZdpL2lb6H3zsFhuulcsnfStfOsEo0gaQfPgbAUDXNfvM35xGZ0nJuOalIuB3gqBCR27W OThg== X-Gm-Message-State: ACgBeo2drnOGeZi6yqDORjQrIhZD6iDWn7jcJzXyb/5s8rbeRwlbJnil sGpiEJ16Z0QxD317/ErbIOzq+fdynOfG6pXc4WniyA== X-Google-Smtp-Source: AA6agR6y3U6pHOb5dcv1vqPpmeMeTXf4aKWp13NuMCnIdt+fRCs4NW7hjbDbEqzFwTS6U1UfXZMpdc29w/Hx7SeWCQk= X-Received: by 2002:a05:6902:1366:b0:691:4335:455b with SMTP id bt6-20020a056902136600b006914335455bmr20426685ybb.282.1662074518009; Thu, 01 Sep 2022 16:21:58 -0700 (PDT) MIME-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> <20220901173516.702122-5-surenb@google.com> <20220901202409.e2fqegqghlijkzey@moria.home.lan> <20220901205144.66ilifzaxr5p4xi3@revolver> In-Reply-To: <20220901205144.66ilifzaxr5p4xi3@revolver> From: Suren Baghdasaryan Date: Thu, 1 Sep 2022 16:21:47 -0700 Message-ID: Subject: Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions To: Liam Howlett Cc: Kent Overstreet , "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" , "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" Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662074518; a=rsa-sha256; cv=none; b=E/bIyvB0G7aADzVdqv+FxD7LoLA8vc7hODeS7bsJxhusLzE9LSKUEWD0AHdKWAr/6MiwZF zMAegiQYrWv0l3JPG6QmIaM4tTW4qgNDvXTxcRa1sMU4jUYeYEjtV5i4ApWkKPtQWBitnn CcPtL9KaSuhQ0mjRv9h08cNyWdkCAh0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=k1eQ5hiU; spf=pass (imf08.hostedemail.com: domain of surenb@google.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662074518; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=TioOqS04vLMS9dH6wDVg3ppqoyZpw4Z0vjZr4LO/zFY=; b=iaDMaoGxRT5iVZ7Su6TBp30Nm/jzCIEXtwlSdF5GxAhdK1nCZsv3wfmpZDJgQxTkWVl6+r it8211KSeb85Dxt7Mp8vSr2AG0vwgcdwbHUsK2ZCz1dPpalSw1iIcbPERvbmNzvqlY750T +VFnmDnJlu2nx5nR/wvJd51Rj1r0XL0= X-Stat-Signature: rj6s86o5966nui6btyr9mxpoc61x67pr X-Rspam-User: X-Rspamd-Queue-Id: DFE7A160059 X-Rspamd-Server: rspam07 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=k1eQ5hiU; spf=pass (imf08.hostedemail.com: domain of surenb@google.com designates 209.85.219.177 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1662074518-29747 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, Sep 1, 2022 at 1:51 PM Liam Howlett wrote: > > * Kent Overstreet [220901 16:24]: > > 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. > > I think this is because the VM_BUG_ON_MM() will give you a lot more > information and BUG_ON(). > > lockdep_assert_held() does not return a value and is a WARN_ON(). > > So they are partially redundant. Yeah and I do not intend to change the existing functionality in this patchset. If needed we can post a separate patch removing the redundancy but from my experience debugging this code, VM_BUG_ON_MM reports were very useful. > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >