From patchwork Fri Aug 4 15:27:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13342033 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 5E1D4C001DF for ; Fri, 4 Aug 2023 15:27:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 848868D0013; Fri, 4 Aug 2023 11:27:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7F9BD8D0006; Fri, 4 Aug 2023 11:27:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6BF168D0013; Fri, 4 Aug 2023 11:27:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 5F6868D0006 for ; Fri, 4 Aug 2023 11:27:35 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3415CB30B9 for ; Fri, 4 Aug 2023 15:27:35 +0000 (UTC) X-FDA: 81086801670.28.7F8BF66 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf12.hostedemail.com (Postfix) with ESMTP id 5F6A140021 for ; Fri, 4 Aug 2023 15:27:33 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="hVA3/ZpF"; spf=pass (imf12.hostedemail.com: domain of 35BjNZAYKCHcnpmZiWbjjbgZ.Xjhgdips-hhfqVXf.jmb@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=35BjNZAYKCHcnpmZiWbjjbgZ.Xjhgdips-hhfqVXf.jmb@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=1691162853; 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=EHpUmzrQnDN6BdHRPVO0KcfDXP0OZ5FbBAepEsSX9Ig=; b=VDyI3a27dFE9hbyNsad1N2clXeoOBWrWB4HRrwOoxSA4SwfJ1TU9f+h3jRk5rOPN8SHTyN k8VWdoUIsSBSJMYVgEvOBXuYY3qoa5zuqSrlebl8pXf8DeC3RwYD0hdEH0+uu25T7wKkhV Bc0znKkozC749MbHSlAuIz9bo+MZeck= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b="hVA3/ZpF"; spf=pass (imf12.hostedemail.com: domain of 35BjNZAYKCHcnpmZiWbjjbgZ.Xjhgdips-hhfqVXf.jmb@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=35BjNZAYKCHcnpmZiWbjjbgZ.Xjhgdips-hhfqVXf.jmb@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691162853; a=rsa-sha256; cv=none; b=tITEa0n84J4/orZlivgx/84378cAc6v5D9ICNCSiIFcoDF7PCZKYDGwcQG8rio5oycL9fC OY8jxUBGUNlCEp2LpkdKXUSq92/BV7IR14YvE39HfkYKZ4TS6YDTtwFEg7l86mSt5sagf1 8844FXwTykwbzuR4Y1Eok/G77lrphVU= Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-d11f35a0d5cso2412503276.1 for ; Fri, 04 Aug 2023 08:27:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691162852; x=1691767652; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EHpUmzrQnDN6BdHRPVO0KcfDXP0OZ5FbBAepEsSX9Ig=; b=hVA3/ZpFJEmsauiGAaXBbjIpfsmpWfR3fbsRgVp5rAEKSt/9A6Xd3kd/eO3AJKJZGn 3AC2ZtIRwv64xHd6WForq8/KFn/Rx8J0hO2y9EPElGCTjTZlFAkT/InmtwUwzE1eqnYK kJASoqtH6CN0ybpUSytgjtDaJ9liKxmHr1g1t4U6N9jwmAFqgwbXaE7cZYKwslngmO8u IcikEpTE0wWzJ4jIGpYVyW//mlltwrZAHvNVNKEreIx7RlfWw5qL77YBxevZNGlJfhg9 fpzNtyDU3iTuo29Qe3cFV5Vv2NkySasem1meuIOuN49ZkF8grQs850+nFjQFoo4gac+A WX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691162852; x=1691767652; 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=EHpUmzrQnDN6BdHRPVO0KcfDXP0OZ5FbBAepEsSX9Ig=; b=coDdoLRgpq3WvcdSVTY/si4XPb2GTVO7A2cq2vq25P1CJI4BhWqkmFcK6zFHPYwRyN mkJN5uda+WpnHKykFwdYyQathQ3JCiMD+klYXVR24uQwcGVbkOohkIlT0+1YkClBEPWi 3sT15F+k5uuZX0BsrRJlyJWf59W/ztSIee4B6aboAXSqpVJafNjSbst5ltZE/QCs7YMw 4eXYpJSWhuXcrNWYmwb9z7jc4N5EM+/KEdixS0X4r0OHmCHExBQlLGlvOGF7Y+G/tIV7 6GVen+t4GfZIIZ1d1YeYVe5Hzj6l0+kWf/4UA/B5zJ3dDSxerjYAi1OWyE+yiLvDB951 awlg== X-Gm-Message-State: AOJu0Yxjo0Q8Gu6wqP3P6bbVSF2IsPKILs5bu9I31umubVsFVRcuk2bL 252gwP0E8AHEHvf+XPsy5tns0k5QmCg= X-Google-Smtp-Source: AGHT+IFqHpzaEQ49U8hAJkm1uL5RaOqEsE7NFQT8Ocv+VjqN2lk1j8DiU0ekVvKXC1nMsrd6uQfY/SIVGJo= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:43a7:a50f:b0fd:a068]) (user=surenb job=sendgmr) by 2002:a25:aa4e:0:b0:d45:1b81:1154 with SMTP id s72-20020a25aa4e000000b00d451b811154mr7593ybi.2.1691162852582; Fri, 04 Aug 2023 08:27:32 -0700 (PDT) Date: Fri, 4 Aug 2023 08:27:20 -0700 In-Reply-To: <20230804152724.3090321-1-surenb@google.com> Mime-Version: 1.0 References: <20230804152724.3090321-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230804152724.3090321-3-surenb@google.com> Subject: [PATCH v4 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, kernel-team@android.com, Suren Baghdasaryan , "Liam R . Howlett" X-Rspamd-Queue-Id: 5F6A140021 X-Rspam-User: X-Stat-Signature: aetxw1u5nw4au6etxbf6oc37kbmzedf9 X-Rspamd-Server: rspam01 X-HE-Tag: 1691162853-32297 X-HE-Meta: U2FsdGVkX19CJdxyGiaj0vjbEaVA9SlbDv+13GMxBzmSku4ZlHP5tM8eKk7DzzYrFly3Hg87GRpPzipGFrNJ2ItVZ2BtFekaddhWShC79Ivol8Wq6qYcVw50P+d6UOpi7lII6ntUZJxJoCLEVmPBcJzGo1xz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/9SvINtZuvRN6pOhJ05j0cvfmEvLQXUiWA0acQJVq/SZui64CAXwKNLhjuhi7FXtEsmniCaqO6LYfHLHFgbl3bFQ21IAz+kfOQ4yTt8QT/gcwoz7pQ0H2mtX8HXjxDH/cqtE3nm/gUTLcGBU85QJqHH+i5lXLnYYgRtDu6CNGktvmP9ehtnR9LQWH1yGU+Iu8VkXIQsDcwlfJPD4dJ9fclzPlw49E/aCCMfCot9j4Oe+k4oqTyXC8hFebs6Lfkl3kSPse+GrEE2IzDfvXARalkkbtWm56AIIfg1D/DfjbFC2QGuXjtKxbKcgn4FQNwfrFCfoKm6ffOsRhAdRpp0JyNsi7KLy5ed6V/K+/rtV22dLTyCkwjKJwUGb20kTa6iK1BHnGkTQyOw1GmprI57ruwHUEL2fCGtYayHR6hR/Gr5lNDViN4Gnuj2Uk+FrPFIO63FPGJoG+ntKAHneG7t+T+1qJunw== 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) {}