From patchwork Thu Aug 3 17:26:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13340369 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 32E5BC001DF for ; Thu, 3 Aug 2023 17:27:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5910280281; Thu, 3 Aug 2023 13:27:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E34228022C; Thu, 3 Aug 2023 13:27:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80D85280281; Thu, 3 Aug 2023 13:27:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 6C01E28022C for ; Thu, 3 Aug 2023 13:27:03 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 2D02F1A0479 for ; Thu, 3 Aug 2023 17:27:03 +0000 (UTC) X-FDA: 81083473926.21.AD05BC9 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf25.hostedemail.com (Postfix) with ESMTP id 4BE71A001F for ; Thu, 3 Aug 2023 17:27:01 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=qxsXQyRb; spf=pass (imf25.hostedemail.com: domain of 3ZOPLZAYKCIc352pymrzzrwp.nzxwty58-xxv6lnv.z2r@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ZOPLZAYKCIc352pymrzzrwp.nzxwty58-xxv6lnv.z2r@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691083621; a=rsa-sha256; cv=none; b=eHPXfUjV6RRabg3Epd1yb/HjauT4a+P50ig93vOWM3yljPs4j1nmkhEHhr3QEZQGUqKXa+ MZl9QyuA0wlctOnuZCqMevs/X8bbJh3bsRt9QAMUnVhgisPa9r4Dc8OV7ML2hEmMd6kAAM vPmfjJtAoiZjUDVIPGfJoy75p3XAD34= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=qxsXQyRb; spf=pass (imf25.hostedemail.com: domain of 3ZOPLZAYKCIc352pymrzzrwp.nzxwty58-xxv6lnv.z2r@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ZOPLZAYKCIc352pymrzzrwp.nzxwty58-xxv6lnv.z2r@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=1691083621; 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=GvSJaYIJvb8li9o8gEVBxsPqBS3VEkgWZZxLZITBkoj0IArpPmgSgfKw1/HZt54CSox0p6 oRWmSGXzirw64C3TOS9tbyr326NADl039hwNdzUxbrk/xVlEaLri22GoIvHgA27nR1y3am wzOwY9Q8Q7PJ5YxJNtZGYqnoNtpjJlU= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5844e92ee6bso13003357b3.3 for ; Thu, 03 Aug 2023 10:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691083620; x=1691688420; 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=qxsXQyRbVAeRELuUUtKrCwywC6QQTi8GHNRwTQUgqwaMaE06n28e21MqPJCBZOSeOT Qdy3T1xm+nWsar3PElAyHH4XRbnbh/juQv6pT24VIx/hmG68SRWkDtgsWgv0Vbw+Xq4b +9kLmoit9sN1/gZfKklOc8XhcuoYMFvLaSeXIo/wdsXcRNSNRVLSqWMC8fCCM8aUcWcB aDSUJ5MX9993h31MPorj7ATaoVZTKC0TIpSNDyVZs/SHr6qPtsnYQt8mS3zlcdzRn4PP n6WROk+TAqngChxc1yRkKMEU0NvNbIWVZIRUByrfXNiHMt2U5V4plrf6i9OLozdZrkBK n96Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691083620; x=1691688420; 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=CkgZC4v55ioor6yLKLJIEZfbkK3h5dRRaYx3azrn9eqQLqHoYU49LzQinEL0VOWz3V LlnZyoAAMKphFGP3VwwfVJzJiXRz6wFjOFFS3myJNYcN9rRZLzUftG+l3nL9fiTg/sTQ 0CO9oNnVBlgcw95UwL6jeDoAH8Xn0VXtI0beEcB/JB67AoXr9eV8hwfPKQrMeFc3mQi4 d0gJUoF7n0nuQTLGNtOHzRdEHFa0xUGDTTranL8Ui1ODuhhYbKerxuKcNccn7lQXj1uz 4P7C+bbMHWKmfQ6+w9E1Wuunz5GK4Q9pD1NJoYhpgMGREh+1jakvd5pwDq8bFHOsOXdC qchg== X-Gm-Message-State: ABy/qLacf2zPNNVv1sRKNXSAJMOwkYPzLe7SZU90luE1c6Baq3PSrglH TcTU6uHx+2ntHQNAov6TpAT6MlRyhPg= X-Google-Smtp-Source: APBJJlFJcCahjdAYX9Zx+DEl8b9H6rEwuNU2P9eGDfvhDJtLw9lJ/qnx3rNt/z46v/MM98tnx4xoFSOUp3s= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:3dec:ef9e:7bf4:7a6]) (user=surenb job=sendgmr) by 2002:a81:c509:0:b0:573:87b9:7ee9 with SMTP id k9-20020a81c509000000b0057387b97ee9mr191557ywi.4.1691083620320; Thu, 03 Aug 2023 10:27:00 -0700 (PDT) Date: Thu, 3 Aug 2023 10:26:47 -0700 In-Reply-To: <20230803172652.2849981-1-surenb@google.com> Mime-Version: 1.0 References: <20230803172652.2849981-1-surenb@google.com> X-Mailer: git-send-email 2.41.0.585.gd2178a4bd4-goog Message-ID: <20230803172652.2849981-3-surenb@google.com> Subject: [PATCH v3 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 , "Liam R . Howlett" X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 4BE71A001F X-Stat-Signature: t4bi4ue9197bwu11x8o74uex9eapmgkq X-Rspam-User: X-HE-Tag: 1691083621-282561 X-HE-Meta: U2FsdGVkX19GhsfQmCm0h/55DfROCBDUgKcbEJ69+bIlZMoTsm2e286raydYvRM6anMewExaYa63Q6lew34256pHzJmT1Jj86aenKzHpRnxrSIXGsvrHvKCVcH4V14uy/R+drOGVw+J75aHdyTKNuzZ+OUG0V6U/Bq50L1uB0TRmNaja3PI6fzrC3KkplKHoju0XA5PwDh6NM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HA5H2k3UyCu/TsMM+3Q1C8W3/9kuGxM3uCSFSp4LyIMOa1eRZO8B/jwGksvB9UxMV3vUwNszA465evJfmMAW9wB7JAJ4YmuA6LLfOnDzzOaMk9fdui+30x9AbEP0FWhsWa/WhNYT/RzIouzZs3YmZG63IjJAvX55ju2kOr2XG70eEnXVMyd16MBr9DHv2Rjffy3HCqUCZSKVLgGyjDo08Eq4PTcHjh0MD66/wXvt5nqvnJxLt6LXkX8WV/e42thHIeO7Lh4v7pZ5RRPvBWUtsI5OQAOCkdDYfxreopfrSSBElasnGcOUbxPjOHbMU9EpFaBYGDXJQnpnEEygTineA8ER814LZwKBPCUSkZuRLxUm/XlPiBq7BYE7hJDGp5VHpan5QfgHLXs9qcPfxD6mkJwKE6/UyHHbl19OXHfjgj35yHZBdXb0Bw== 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) {}