From patchwork Fri Jan 27 19:40:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13119250 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 7B8EDC61DA4 for ; Fri, 27 Jan 2023 19:41:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06CA46B0083; Fri, 27 Jan 2023 14:41:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0190A6B0088; Fri, 27 Jan 2023 14:41:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DFB8E6B0087; Fri, 27 Jan 2023 14:41:45 -0500 (EST) 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 CED0D6B0083 for ; Fri, 27 Jan 2023 14:41:45 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id AFD6C14072B for ; Fri, 27 Jan 2023 19:41:45 +0000 (UTC) X-FDA: 80401598970.02.51E116D Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf20.hostedemail.com (Postfix) with ESMTP id CD38B1C0024 for ; Fri, 27 Jan 2023 19:41:43 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=SD5yhaj9; spf=pass (imf20.hostedemail.com: domain of 39ijUYwYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=39ijUYwYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1674848503; a=rsa-sha256; cv=none; b=wMQ6EHNo8xz7VwBB37DhDNtW8ZUlhfTnTo20S8A0Ai1IflbC3MnfhXCGvTl5Tv4KH6MulQ R2I9Y2xD2vdtzMyQrGnONDwG5XjPf/RmN3XOFGf5/dnXHCJEGJtlPOT6832m/YZU9XyVJd b/z3QQp/Go1IoosQvFl2NkwGqcpbPtU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=SD5yhaj9; spf=pass (imf20.hostedemail.com: domain of 39ijUYwYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@flex--surenb.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=39ijUYwYKCL0vxuhqejrrjoh.frpolqx0-ppnydfn.ruj@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=1674848503; 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=Hq20e7KS4f4C48PKmYYknVSNimtVVHYzyV8VwmVTJ0Y=; b=ruUxmDykOFDhGnREthCVH18E/FjDSVwU6SgiBvotVWSpXB60jaoHeC6qI2ov60dwVfLInJ /TmlAq92/fl30R+JPIasbK9BvTyHe7vvhCiRlIqE5ep/32pT8vC+2GItJ2tmaJQhK7Si+B 5rPtwGSqSP81b0HAuZnpUdDxvHU9Klc= Received: by mail-yb1-f202.google.com with SMTP id a4-20020a5b0004000000b006fdc6aaec4fso6430931ybp.20 for ; Fri, 27 Jan 2023 11:41:43 -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=Hq20e7KS4f4C48PKmYYknVSNimtVVHYzyV8VwmVTJ0Y=; b=SD5yhaj9WNDyBmH2zVXxIQSAPvkdOOdT/eZZRKlGP77z2J9nVnn6Obfbxv5sauUEV/ LCtaz+vX4qip57892cEocWjVTNmQS4/TdyxbxT8xLbIWgkt6lFG5ZxopwUuxBJEnTkjr vQID9RMKTIQGW2sRQmcGmPfXjoMh0D1eDPyuL/b6rqwKxYdkfEYgEgHjQL0Tw8ZlMbjX ZH2/uoF+k+VRzud7oIym//RQdtO+lmKAHdfjocpDVWhkn9piFYOBRbFkKQo8sM+osjEQ FxFQ0vmeBJ9JfrQeSA2WMn51BintgFmdPrgL1EZjLw25vLNDWAlkic6I+BYJ/3xqK9CW +GQQ== 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=Hq20e7KS4f4C48PKmYYknVSNimtVVHYzyV8VwmVTJ0Y=; b=KWEY6ALH3pGcLI2Fer3k6xlbYtuXz+pZyEvdsU4KhJ7oj8cfEZ3iWM33xD9Rs983h8 ej5SB6sNgyxgB1ePyWcYOmgsnyFMtlsmhLWmrNHhbY4oTE9JMydy/5hBaB4woQFeK+1u cWZeiOc2ymvRGadSJ70NsT6TdyBglTKmqxdNXC49/7eQFsHBILEKinzE0zG/cVDGnpIw uxZfSVJ04zO2MhEJQVANbmP+fo8ZCjVi4b93mtNZGj+F0Do3rbN3YR47YFsVjCmqVa0d bJMon2c+O0Pse5VLj76A2vaL/+e4Lz6gMZgaAFXRqlEdGx8lnnjq7nC9R5xB2yYm6sts JwiA== X-Gm-Message-State: AO0yUKWKWY2XPati7i3HFNJUHrbFhI3kN4eabWulAEDEbmOz0sVfxEJU lzSbwqBJTQ9xVpgRZhbyJOKFQBOkoqo= X-Google-Smtp-Source: AK7set9CI7/3kZjfJSWqixfLkcUok8XHsx1YNSreUFU581ZlI+jbpFxEiZ86BfATPj+NjPN8bnYvtim468k= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:4e19:be9:c5d0:8483]) (user=surenb job=sendgmr) by 2002:a25:b283:0:b0:80b:c7cb:6d1f with SMTP id k3-20020a25b283000000b0080bc7cb6d1fmr1156521ybj.298.1674848502930; Fri, 27 Jan 2023 11:41:42 -0800 (PST) Date: Fri, 27 Jan 2023 11:40:49 -0800 In-Reply-To: <20230127194110.533103-1-surenb@google.com> Mime-Version: 1.0 References: <20230127194110.533103-1-surenb@google.com> X-Mailer: git-send-email 2.39.1.456.gfc5497dd1b-goog Message-ID: <20230127194110.533103-13-surenb@google.com> Subject: [PATCH v2 12/33] mm: mark VMA as being written when changing vm_flags 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, 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, 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, surenb@google.com X-Rspam-User: X-Rspamd-Queue-Id: CD38B1C0024 X-Rspamd-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dW2RPyyw0QoMD4BYHINQTdn6CL78llKvrTebxWcXk5KePwhQYwmYsvn7EsJ1d9beKiarbuMnwPSPNBLmm37qNtu0mmiMItJZPyRwYu56VRH66TQqO6ElyKD0/vgwR1IjwFBAuPVQ1GrcDeRcVy/9ZcbWuCSeANFr91vSsXqXzSYWT0cNi6vxuNQFg3UoVwfFrIL1j1C6okDr1ItRfHvFRNrrJ6KGYPe4UC0cpnRu72AYQ93brTzW2yPqGpXX/FRRlZtJrr9vP0JJ1r1Eh48g+DOrJOTCikv42gDIEaBpriXsjddfXeCV7VmdRhzkGDTEwdLSOcwyNh74TMO4MiiXLkJ8TlX6KTMNdL1AoPhUhz8yrt9FhqDgveHoeS5QW0yNnL7ImGnyEytRv7TbL1fuisI2uCmlcjYNiqVQQtS57lMip+931Ec94MU94peKNtq36RoI5Z2llyT9BklAXTkEvrFXsGZwrMQqbl18qsAj2dA6GKAyFYo1Y953hZUQiNZd0RHykJLmnP4ZIDSoBzhvaasKRZY7dSMMgH/6EEghQ2fAR08qgjlUFe/CwztlPS/EfLGuh+YqGTOSfbgr+nrvPpM1v+FtrQvnZuOO6uhmgdzION1cSb2MFQKli9aqCccORBIUzq5dYUn/NEV50Q4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000121, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Updates to vm_flags have to be done with VMA marked as being written for preventing concurrent page faults or other modifications. Signed-off-by: Suren Baghdasaryan --- include/linux/mm.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index fee08e8fdce7..66dca140695e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -720,21 +720,21 @@ static inline void vm_flags_init(struct vm_area_struct *vma, static inline void vm_flags_reset(struct vm_area_struct *vma, vm_flags_t flags) { - mmap_assert_write_locked(vma->vm_mm); + vma_start_write(vma); vm_flags_init(vma, flags); } static inline void vm_flags_set(struct vm_area_struct *vma, vm_flags_t flags) { - mmap_assert_write_locked(vma->vm_mm); + vma_start_write(vma); ACCESS_PRIVATE(vma, __vm_flags) |= flags; } static inline void vm_flags_clear(struct vm_area_struct *vma, vm_flags_t flags) { - mmap_assert_write_locked(vma->vm_mm); + vma_start_write(vma); ACCESS_PRIVATE(vma, __vm_flags) &= ~flags; } @@ -755,7 +755,7 @@ static inline void __vm_flags_mod(struct vm_area_struct *vma, static inline void vm_flags_mod(struct vm_area_struct *vma, vm_flags_t set, vm_flags_t clear) { - mmap_assert_write_locked(vma->vm_mm); + vma_start_write(vma); __vm_flags_mod(vma, set, clear); }