From patchwork Mon Feb 27 17:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13153974 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 ADFA8C64ED6 for ; Mon, 27 Feb 2023 17:37:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 491856B008C; Mon, 27 Feb 2023 12:37:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 444BA6B008A; Mon, 27 Feb 2023 12:37:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F9DD6B008C; Mon, 27 Feb 2023 12:37:06 -0500 (EST) 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 CE92E6B0088 for ; Mon, 27 Feb 2023 12:37:05 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 7C6AFAAEA7 for ; Mon, 27 Feb 2023 17:37:05 +0000 (UTC) X-FDA: 80513777610.06.8B99643 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf25.hostedemail.com (Postfix) with ESMTP id A5C95A0024 for ; Mon, 27 Feb 2023 17:37:03 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=XsYGyrr6; spf=pass (imf25.hostedemail.com: domain of 3P-r8YwYKCC4cebOXLQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3P-r8YwYKCC4cebOXLQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--surenb.bounces.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=1677519423; 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=Ls18it+007PHyc+1gU+R0B2Ah0edgQPBYFo5Fg80PJ0=; b=CJapzgghQCFSEFULiQZBbSVcynoSj+ljvw6JNeesf3TcgkTI1zRed6o2iGUa/UjLm4JptQ JD3gv85sAfaYKUA7/JwtvgvMBmfS+7F70g2hCFa4vhAm5BYR2JZanrYkjKSNkZCLQ13oR3 ZVHIzNJQE44cTj2TWMA0czChTB9kHh8= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=XsYGyrr6; spf=pass (imf25.hostedemail.com: domain of 3P-r8YwYKCC4cebOXLQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3P-r8YwYKCC4cebOXLQYYQVO.MYWVSXeh-WWUfKMU.YbQ@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677519423; a=rsa-sha256; cv=none; b=HapTmj0ZlcPRCFL15SfRtpqODgke2oHGmxTEm9fQ1uaTG6I3JY82qfU5lVGM9p+AyY2nUL sHiaVvcTX8slG2svzKmH2294dz8HeFLrYYNt4GsCs2gbMVCCJA3jNiWhJoky9jblkBU04F Oqb/u/mc+phTakDM6VO9m8Db181cgzk= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-536e8d6d9ceso153563077b3.12 for ; Mon, 27 Feb 2023 09:37:03 -0800 (PST) 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:message-id:reply-to; bh=Ls18it+007PHyc+1gU+R0B2Ah0edgQPBYFo5Fg80PJ0=; b=XsYGyrr6UscqFf/3E/PqXH+0brCoiV/AniBzcmo5DJxAd/4Bmzv4DyD8sM4NuAQxi8 dZWrcG1/ZDBfEbfkvX95mB7A+YCMYHAJEmom82/9Nzaqf1YzLljv1hrT1/pnhQY+fnL+ IOvvFbrnVTXpiEotFDmf2wc0ksmnu2CR25KjblrUK/fkJWLyctUr7YoQUoBBpu2dXgAS BlvIHfsMMuqia7hwWHF3vceBwA8k9G+49DeoR5tUXJAWoHB1hsAUuDBJJWuX8cJ0Z90U 6Vd32qha+psgDSdv++LPDOcFAXLUVGYeIPM/jmszF46HDebsTawQRm0lgk8RRbgTNhtx sLHw== 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:message-id:reply-to; bh=Ls18it+007PHyc+1gU+R0B2Ah0edgQPBYFo5Fg80PJ0=; b=vjWMfBqbiDfVNXVVnjz+NL53U6oqYi8noiRgJhN23B3xaPdp7XUsLZWx+Gv+Rebw7L dDU8qtg1NbAOx/51LN1pEI4x/1OwSOQpCvkarESJVmG5t3/Z6gP5zHcoLrrO+mhU7Bfe Ymfgu3QCskOF/9ZIxdqWQhY9CGDO27f4AUAOnzEN0OCWtMLA3eunrFKpRfnj7xAw9Udj 6ZUtIT/7keV9PtBN2V5+9emlkjjJW/RrCicAoOn7A4QEHbOUmySO1wr+XMUCaiesNJ5y qZfQXNo+hEBL742YVtZUBK8quK7UjqzW2vInfENplkSe5zyTcG77mm4rEzLI81ZJhcAh 9pMQ== X-Gm-Message-State: AO0yUKWGiDuyEF+9q0kJLOQWluFacbgZVDnOosRDd4DdhuptdZ8EKRdY DZIQhqkBJ2F1DMmz9bZtA2zXhR4JHxM= X-Google-Smtp-Source: AK7set84bNGznxOoxVaVlILHB4VZYiPLd+BYNZO1PonJXcuULbgT0KQ1/CW8aHys4CM8FC8mlmVpy5ibqO4= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:e1f6:21d1:eead:3897]) (user=surenb job=sendgmr) by 2002:a05:6902:1007:b0:8f3:904a:2305 with SMTP id w7-20020a056902100700b008f3904a2305mr261507ybt.2.1677519423051; Mon, 27 Feb 2023 09:37:03 -0800 (PST) Date: Mon, 27 Feb 2023 09:36:10 -0800 In-Reply-To: <20230227173632.3292573-1-surenb@google.com> Mime-Version: 1.0 References: <20230227173632.3292573-1-surenb@google.com> X-Mailer: git-send-email 2.39.2.722.g9855ee24e9-goog Message-ID: <20230227173632.3292573-12-surenb@google.com> Subject: [PATCH v4 11/33] 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@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, paulmck@kernel.org, mingo@redhat.com, will@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, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, chriscli@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, rppt@kernel.org, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, leewalsh@google.com, posk@google.com, michalechner92@googlemail.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Suren Baghdasaryan X-Rspamd-Queue-Id: A5C95A0024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mn4AwxStVV6WjucwWKX8Nj8lfa9QsiKfUrZ8X06QvXn6Fo51Jt6/7re5LPzTg/88tABcRerKBmMYFjOyuR+zAzEfe9Gdnl+gnRY27xMq0D7+E/eWpPi28zsu1vYQ9KQLFWH51doz/R109EDjvc2fSoeK4zrZcqWl/5nKJqfoK4M1JDDqmQSsAw2226lieJkRxmjPjTZZGCMxgiTsnMk9TpjEjDZdvPlE4+SjuWK62duuwQ1oMEwzAtUlcAGlSafGRgxIcesROotpqOpynlPFAetHvi+4joSmQ3NgEmOgFtKIcxZfu9N2k4UqtgfbgeLujnUJLZ6oqM26Frf/EIN/ABkhsNiGFyZu/yM5Cz08XHaHcKke04S8wkDYizJ2YmrZiBdqRuNJVDTjVzbRmNDXMNR5EgEKN8swE/NZhSa/qLjwTpUVxxabOCKgbTKslcwSXJDnSqp0jPzehjXt97VPAKJr3KPpymjg68cSBrle6V/ZljlUcrOFLX0CISKFrtlklXstUtPeSGHgLPr0Z/JTvB3uzBb04C3bq5u0AALANBwwVKkoYBi/Xy1U0xTrgMYgW7zSCJx9RnFo9cwdx0nbTsYSQiUgngTXdlWSOqWi8T0090m7F/rcHc1JJcEW3eLuM4grHWMXjo4aNYi1aW9/Kjm0mOBbBh4zgoc5sM61Z4= 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: 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);