From patchwork Thu Sep 1 17:34:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 12962999 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A8B43ECAAD3 for ; Thu, 1 Sep 2022 17:37:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=ipXSV+v03npSB1uLTu43+oTA4ME3hw5EsSRmZEb138k=; b=0sBakXkHxjhEW87h68m9PYntFR b6nn94FTt3T/RoFJZlqdCBker/0Zd4S7Kk1sNxoTllrG0su63F6cwI+fz5JNMnoSyoOEeet93CcuJ OOFsry7/vTWR/q7ZJwT1N86x0crkjxoJjDVKLiRzP5s6xSqFqv5nhQn3uZ0hKfmwEOzeEoDP+reMX WpCic5DuCccud8s6N28V/HCxw/Udq2uFaMF2UTBcRTtQNvl66dXdhQRMHI66SuJMvvughg5ppj0DD 7hDPeLpwhVY1Wi/Gs/8mvwW5AXNwaASJs+7TzyyJnInlnh3Xnn93VlwMDFL2I8kucnxbKf/f08jvP WIHu+gyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTo6z-00Dbqy-Mi; Thu, 01 Sep 2022 17:36:17 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTo6M-00DbOw-Ch for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Sep 2022 17:35:38 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Cc:To:From:Subject: Message-ID:References:Mime-Version:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SmLlv5S95s1SYD/hq46yY1KSJ7CCwWbvNekA+AzNinI=; b=INos90YTuX6AoIiZyRrPYeqLGB rjabHJ7/CuWjO44Na1i67BIQMVY96hiyN8rGf+BUkV0Y2ZBYk+KWLE8kWLGA+mjFc84QjGv0a7pHB +tzcDazi5oPvf7TYzRYDBiSG1Ti6AYol9LoWbITII6UqlUhK/l4iF4oVerawLkT8UmVLmh77bHO8Z 5/IEFSRPbRm2sIE6zEBj2HkSbCW2vJG/sQlFaRp6vQQ0rZMtnW3UFR2gyn2eWD+DF5gs0la4jgNcW xSxA1/y0MZo4+CnPJXCO7t/17ic4B8xf4HjzeJU4uCK6QZxxLynSCwZcjIbOYPHh7w+JeDOOKCK4+ tNWon64w==; Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oTo6I-008RcA-HP for linux-arm-kernel@lists.infradead.org; Thu, 01 Sep 2022 17:35:36 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-33f8988daecso226840387b3.12 for ; Thu, 01 Sep 2022 10:35:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=SmLlv5S95s1SYD/hq46yY1KSJ7CCwWbvNekA+AzNinI=; b=IEnDpG3YZTPCaLyxObjk7amCPTURBOnqU7bJ+HMdi+ub5B49wgcvI5S5rtmD90rv2Q AZvqZR25+q4mnRP5jUchvAffVc/FzpkmhNDkv4FRnlMM4OlY6itcjxw3UZXpfpnem++C EJWIMKaiqyYuCH4R4X9b15IgDB9xODniSPpGeOsiXfRmLSll0Bi1jUHU15lpXlXRSc5J +CLYoEdfwTQrLCZejly8sqYsr7A+RsOmJlAwK6fhbCZlwscLc4WTaIF87eXTXBY8BoJB i633PKqUr/jul5ZT9UiyTCl07dJq2r9+I6Xxo/FEUAli95MNIWyATvVTZ7NKsjxM0gu/ 3dZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=SmLlv5S95s1SYD/hq46yY1KSJ7CCwWbvNekA+AzNinI=; b=TWe/N7nk4tPBvdovYbBE43Jh5eWJlDRTgpz3VCpCkkK1HZ5Yo9pHJIhiypSDaefO9Y /mApINIel7aMlOhZfGcl3OG6VGuQfYi6uBTDASuAOmAqL8wJNqlYQN2SuXJyY13Wu4Vl WYCeh/x88t5yb9KTEqZRF9l7w6sSMhhUJBiHHkwguPAbku7iHulExeJpvRrl5Vosk1ta ZguRR9xJgI/GmRicdfpke58Ywf/+lnYhUuOdXorzSx6xAnkzUY7MppmLL7pc7BAdlG12 eFdtuXP8E2iTTGGhX6URSq2RN+tWqcmSDT0Ab/7FiA0iVKoFwZeH+8HrW2lwuMDaf4P7 k08w== X-Gm-Message-State: ACgBeo2YzPlyIek9jX8JFOGl9HGaHvLBBT6KeUDfAepAYd1ILO7GOqEZ BKVICQV2TVpLxt3W8YN55MoEBFN5pJw= X-Google-Smtp-Source: AA6agR7LHtl/RnUFMM8Ba/UDLwcr+KKZqP3s3F3o0L7ZSX4nHIA8V0azyARB9tbw+yLexNRTedxLJOpzAXk= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:1bfc:e7ee:6530:4449]) (user=surenb job=sendgmr) by 2002:a05:6902:1366:b0:691:4335:455b with SMTP id bt6-20020a056902136600b006914335455bmr19454643ybb.282.1662053731874; Thu, 01 Sep 2022 10:35:31 -0700 (PDT) Date: Thu, 1 Sep 2022 10:34:52 -0700 In-Reply-To: <20220901173516.702122-1-surenb@google.com> Mime-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220901173516.702122-5-surenb@google.com> Subject: [RFC PATCH RESEND 04/28] mm: move mmap_lock assert function definitions From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: 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, kent.overstreet@linux.dev, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, surenb@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220901_183534_690546_9E8A041A X-CRM114-Status: GOOD ( 10.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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); +} + +static inline void mmap_assert_write_locked(struct mm_struct *mm) +{ + lockdep_assert_held_write(&mm->mmap_lock); + VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm); +} + static inline void mmap_init_lock(struct mm_struct *mm) { init_rwsem(&mm->mmap_lock); @@ -150,18 +162,6 @@ static inline void mmap_read_unlock_non_owner(struct mm_struct *mm) up_read_non_owner(&mm->mmap_lock); } -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); -} - -static inline void mmap_assert_write_locked(struct mm_struct *mm) -{ - lockdep_assert_held_write(&mm->mmap_lock); - VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm); -} - static inline int mmap_lock_is_contended(struct mm_struct *mm) { return rwsem_is_contended(&mm->mmap_lock);