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 42202C001B5 for ; Fri, 2 Sep 2022 17:46:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AAE758D0014; Fri, 2 Sep 2022 13:46:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A5EA4800DD; Fri, 2 Sep 2022 13:46:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 926348D0030; Fri, 2 Sep 2022 13:46:33 -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 8584F8D0014 for ; Fri, 2 Sep 2022 13:46:33 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 56E6F40924 for ; Fri, 2 Sep 2022 17:46:33 +0000 (UTC) X-FDA: 79867875066.23.78164DA Received: from mail-yw1-f172.google.com (mail-yw1-f172.google.com [209.85.128.172]) by imf22.hostedemail.com (Postfix) with ESMTP id 04B1BC0063 for ; Fri, 2 Sep 2022 17:46:31 +0000 (UTC) Received: by mail-yw1-f172.google.com with SMTP id 00721157ae682-32a09b909f6so23760407b3.0 for ; Fri, 02 Sep 2022 10:46:31 -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=NSRndixZOPtPP2wASFAk4jDgEuiWo0dI3vnvon4iVQw=; b=p7yNLbs3A5QrKhqddelaYGVcTxeyeBxU6V+CfdZl8egFvd/kd/WfV9WhezQZtduD6U ojUTPDqjmbVXUP/qOTQPhW1iVshOCe2/Kkhz9tx+/VHsbb3s9z+ix80u0zoMvuDVLsQB S/Cxva/vEynV/XJ7yvbf62BupfG2Y2C3SYRhWwecv+MxIs/2Pzdujt1V0m7EMZ54a3/6 19zervSnL1o4aOPUCovxya1eT+MWmyz2/s9L2sHGaXlBv/pUOAES9XRIbgskqOYZFOnW ylq4VF2M8F7Gfv/jH9DNcMnD9repohepfZJtVB3QBDZAJd9V4ggMFUAjBmSpxHZ+g1Yv 99IA== 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=NSRndixZOPtPP2wASFAk4jDgEuiWo0dI3vnvon4iVQw=; b=kfOjWZLX2ESH71QS94ON64A713myNqYtFw9BV5B5oBmP/NMJobVx1S79RPau1mTwmM vk1vNcI7BaqU4xF2NBm8HMAzH/I7OjsHiKUxC9EY3K+KN+XktE1nAnnu41qgD3AHw2NK N7D4PsnjN0oa/Hqz5pLhTc3keVT241pGfazJPcSub7VjiYw5L4PJrDxmUhQgnc7cxbVh AGVkFHr+UI+aLj1npOs3Mu+t9yRE+oVkSMDQv+71rx13ueR7Nw4fFD9s1szWYB1KNfFx zuQ8lk9nAMnPXaj607WOeBuVfAAdgFwOCZQvj8qa53qHTnMpzCY8nbsQG4KdIfo43Ddb y2sA== X-Gm-Message-State: ACgBeo2q6kpsXlP36bBOZacFfMx0ZNAEoyKhBQs4wyV1bEq1PqbClbEY aWI40BiUS0sGdIolUQQocNT50KmVBgbOzQ8WMVseWA== X-Google-Smtp-Source: AA6agR6GDF9sHJzcyjUaya7fByUdhkEhzDw6yipl5NEBaRGv8CiuB2xbiyA1Dj0na3Efi1HIFlyduTjOsTurz7MleBc= X-Received: by 2002:a0d:e7c3:0:b0:344:8cee:c384 with SMTP id q186-20020a0de7c3000000b003448ceec384mr7800183ywe.514.1662140791101; Fri, 02 Sep 2022 10:46:31 -0700 (PDT) MIME-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> <20220901173516.702122-5-surenb@google.com> <20220901202409.e2fqegqghlijkzey@moria.home.lan> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 2 Sep 2022 10:46:20 -0700 Message-ID: Subject: Re: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions To: Sebastian Andrzej Siewior Cc: Kent Overstreet , Andrew Morton , Michel Lespinasse , Jerome Glisse , Michal Hocko , Vlastimil Babka , Johannes Weiner , Mel Gorman , Davidlohr Bueso , Matthew Wilcox , "Liam R. Howlett" , Peter Zijlstra , Laurent Dufour , Laurent Dufour , "Paul E . McKenney" , Andy Lutomirski , Song Liu , Peter Xu , David Hildenbrand , dhowells@redhat.com, Hugh Dickins , David Rientjes , Axel Rasmussen , Joel Fernandes , Minchan Kim , kernel-team , linux-mm , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, LKML Content-Type: text/plain; charset="UTF-8" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662140792; 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=NSRndixZOPtPP2wASFAk4jDgEuiWo0dI3vnvon4iVQw=; b=ql6yh6eMB2IQXhuAt0jBEV/Ls+K3+3U26uM3i5BMjHll2JhPrBkEl4oi5pAGdHSWrJ7BST +ntULfQ9DRUOax/lAkJxhwKhA87VGWPETJfGW3Dv16uyqleOuc3nJs6yPlJs6z7tlZC1Al urOpvG1REr0ZOy+k4I2Y26StWyK3LIE= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=p7yNLbs3; spf=pass (imf22.hostedemail.com: domain of surenb@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662140792; a=rsa-sha256; cv=none; b=C6Cyj2FZ7AXEtkOY4388An345/rb0re0tQC9i72bskCBsRXO2Zf0lmYH5BG1X0Wy287P7e RrlwLp9y5aFBURxJQ3VxRBKQPnPpkdDSnKRCyAmsL+ygfv84d/Egdz3DUAiZgcpsdmN9DC bmAwqdbNRlXxNyJVXjqPH4l2uRMD2zU= X-Stat-Signature: jy8a9gfegoogf33rzgehyz8ncxbyaec1 X-Rspamd-Queue-Id: 04B1BC0063 X-Rspam-User: Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=p7yNLbs3; spf=pass (imf22.hostedemail.com: domain of surenb@google.com designates 209.85.128.172 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-HE-Tag: 1662140791-403593 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 11:23 PM Sebastian Andrzej Siewior wrote: > > On 2022-09-01 16:24:09 [-0400], Kent Overstreet wrote: > > > --- 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. > > Exactly. rwsem_is_locked() returns true only if the lock is "locked" not > necessary by the caller. lockdep_assert_held() checks that the lock is > locked by the caller - this is the important part. Ok, if at the end of the day there is a consensus that this redundancy should be removed then I'll do that in a patch separate from this series. Please note that in this patch I'm not changing these functions in any way, just moving them. > > Sebastian > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >