From patchwork Tue Aug 1 22:07:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13337304 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 D4C17C00528 for ; Tue, 1 Aug 2023 22:07:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 627C4280100; Tue, 1 Aug 2023 18:07:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5A55B2800C8; Tue, 1 Aug 2023 18:07:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4471D280100; Tue, 1 Aug 2023 18:07:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 31B252800C8 for ; Tue, 1 Aug 2023 18:07:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 01A051402B5 for ; Tue, 1 Aug 2023 22:07:43 +0000 (UTC) X-FDA: 81076923648.16.7AA918F Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf30.hostedemail.com (Postfix) with ESMTP id 0E96380021 for ; Tue, 1 Aug 2023 22:07:41 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=V9cpwSEL; spf=pass (imf30.hostedemail.com: domain of 3LYLJZAYKCIQ02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3LYLJZAYKCIQ02zmvjowwotm.kwutqv25-uus3iks.wzo@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=1690927662; 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=i6HEpkZDiMCJl1HNBxUq/pPnwhYuhlhYWrvFQybpJWY=; b=VF5t0IX/YckN3A5/IPOzTIir0H9YW/4EIbvLTb9S0P0HGZxltwoj6d3R73xYtLI19QDPiX yenVr62t4sR1o1xPLRaLLUHf/vOI5SHPQSR19IyIGnk+g2/+aWOWhFWsTOyRxX8QK6+UT5 E3k7xvBxe8gBUWIldYH2UcUL0uXlXIE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690927662; a=rsa-sha256; cv=none; b=pLhtXfQWcYimDlqYeqofRXLxJ/anICYs7Jdfv5pMo0WE+12X/PEiz0R33/NL+KJPYXsgYV EqT8DDxxGW+iOIqzTgnEs3U1xfy2bA+Oxe8hqxwu9LKsO1+XVpV1jd+PCNE/ZxAkf7ub5K SfSWGG2eHcxP+ZMMYCW3WdmRypz5ITY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=V9cpwSEL; spf=pass (imf30.hostedemail.com: domain of 3LYLJZAYKCIQ02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3LYLJZAYKCIQ02zmvjowwotm.kwutqv25-uus3iks.wzo@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-58440eb872aso78282457b3.3 for ; Tue, 01 Aug 2023 15:07:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690927661; x=1691532461; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=i6HEpkZDiMCJl1HNBxUq/pPnwhYuhlhYWrvFQybpJWY=; b=V9cpwSELJrkQrszXU5HyumPij806LjFOgAKqGQckrRIsTl9WyJGm7y2tP2Z2qpZNBZ 8OnG+G2+pRoWY7Gyh/uRKHckpG/wW2klLNffgsUon5TtBq05uulzu7VlS14UeHcVePc5 6rcXGltEDaVNS9+SeI1i+AP3HDVebAv3PFT1lfSUDf6ep/jTCQ/IUFd9ttrSEA9t9DPO iGN48DWEsdFNb4WBgDh2gwPyzp4LH+hHwffYSWHoJfq3HFOTa5CTWqxb2Bx96ZnBccWK 7hzPD483pGlx4dh0dSN4wMfxSLMa6kthAGUj3r6PC/2LNnNJKhb7gl7lRbdc8DmYXSji 2fsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690927661; x=1691532461; 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=i6HEpkZDiMCJl1HNBxUq/pPnwhYuhlhYWrvFQybpJWY=; b=NOSB5NwMSkJ/un78FyLkb1HqEypJmEq5niTC65SHJmG8D97+kCCpvty7Ozz6NDKjlM l8EHeVG87Nu1e5GGH55zP3dVRmK0lRUbTvSCzaIxMo72EUnB7gSbxZwwALdb1NcPRYAA ujNpYtpblJBWLF2ZOe38Oqki6LbrE95Nis6M/6hZ5o9qRDxCmN3lElFtnH0OyiaV4I3b iOC008CayYQmA+8xIHBd19ONHnthr4L3Jm4MRDfXU2XmPCIX00ekVH4aofVIRLEGKY2l h9FOJ8GPPZifbQn3IPlY5vi2h6nzdCdGkwS+zGGSfHPjob88OTrmsCbBFtrPhydFG/2Q wSYQ== X-Gm-Message-State: ABy/qLYXw+k25nq2WOL51POe/hypRTIJZAnF319QYrICLcF43BWIzuZ3 XJdxvRrmUpP0kzXSdQ/EsMBHM9gzvVk= X-Google-Smtp-Source: APBJJlFo/x04tiw33tHz2z8eqoNqUG46TlCYKQtLqzp9NxrzX4ldQZG6AFgAiSwulUiFVWDLbQZPP6VjmRI= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:211c:a2ff:f17b:c5e9]) (user=surenb job=sendgmr) by 2002:a81:b703:0:b0:584:41a6:6cd8 with SMTP id v3-20020a81b703000000b0058441a66cd8mr114995ywh.8.1690927661105; Tue, 01 Aug 2023 15:07:41 -0700 (PDT) Date: Tue, 1 Aug 2023 15:07:28 -0700 In-Reply-To: <20230801220733.1987762-1-surenb@google.com> Mime-Version: 1.0 References: <20230801220733.1987762-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230801220733.1987762-3-surenb@google.com> Subject: [PATCH v2 2/6] mm: for !CONFIG_PER_VMA_LOCK equate write lock assertion for vma and mmap From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: torvalds@linux-foundation.org, jannh@google.com, willy@infradead.org, liam.howlett@oracle.com, david@redhat.com, peterx@redhat.com, ldufour@linux.ibm.com, vbabka@suse.cz, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, hannes@cmpxchg.org, dave@stgolabs.net, hughd@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, stable@vger.kernel.org, Suren Baghdasaryan X-Rspamd-Queue-Id: 0E96380021 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: 1m5kew4jt491ahbpusqjpt5m9cgi4gyr X-HE-Tag: 1690927661-80100 X-HE-Meta: U2FsdGVkX1/nsvezzNP6FETaW+rMPQ4J5VbAQfT1qo30N69KjMrXsOMZ1h5ljv7g0BIYnAgSilynHyoNVs6FYEHadwqCb+ux1Bxr2xdkg93bf8y2qkm6bVOzwTZGKvhr4GVezKnLVpliHN0hcOldQmHGZPeg8zJXo5xX1qHN502UnKkp81VcCK24JxaHqFrqT1FAWNv544oJ/5IFugg1MvCWSw8U2dA8c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IKWFWAUQikN/ybNYAzRS9vsNHPfS7k6wC/409SGoBe5agf9R0gl39tg7OJZ4fPdvojDc8U3YtOGDHlxQP8GMjLNfg5PYP9F+tEbPLqrLsNTSBEjMArxk1wEofGmLuUaOiDIHZLHCAwCHrWTnbKuAl6lldPDwVB1zbb7g7aeh2LtXYHwBMZNCluJMZLA275KSRWaKdM35jIIeWyYUKjZACvZxg0M2mwL6tb0DhPz3+YymBRt6FmCbL8CPG4vbAAz7A9FSjJxfPjoMguycz7E5/RPqhkAV1ULLRWunmhg8f2zEaQS7cLppQFsI7EqsuvwjHr1I9vSR2cQdcrmHwoI1q++VKTjpsLKK7STUo2dXadAsRgmVlv47sVB/54pdsBBz+LuwQ3NaDi07bAONMDjZRsG2HyNP7rOhkw4gU61Rzzsd56biC8f00RLKoH 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: When CONFIG_PER_VMA_LOCK=n, vma_assert_write_locked() should be equivalent to mmap_assert_write_locked(). Suggested-by: Jann Horn Signed-off-by: Suren Baghdasaryan Reviewed-by: Liam R. Howlett --- include/linux/mm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index 406ab9ea818f..262b5f44101d 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -750,7 +750,8 @@ static inline void vma_end_read(struct vm_area_struct *vma) {} static inline void vma_start_write(struct vm_area_struct *vma) {} static inline bool vma_try_start_write(struct vm_area_struct *vma) { return true; } -static inline void vma_assert_write_locked(struct vm_area_struct *vma) {} +static inline void vma_assert_write_locked(struct vm_area_struct *vma) + { mmap_assert_write_locked(vma->vm_mm); } static inline void vma_mark_detached(struct vm_area_struct *vma, bool detached) {}