Message ID | 20230216051750.3125598-19-surenb@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 EEF69C61DA4 for <linux-mm@archiver.kernel.org>; Thu, 16 Feb 2023 05:18:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BE586B0098; Thu, 16 Feb 2023 00:18:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 847E46B0099; Thu, 16 Feb 2023 00:18:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E8576B009A; Thu, 16 Feb 2023 00:18:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 5606C6B0098 for <linux-mm@kvack.org>; Thu, 16 Feb 2023 00:18:41 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 28E6514071F for <linux-mm@kvack.org>; Thu, 16 Feb 2023 05:18:41 +0000 (UTC) X-FDA: 80472000042.17.6763419 Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf29.hostedemail.com (Postfix) with ESMTP id 68973120003 for <linux-mm@kvack.org>; Thu, 16 Feb 2023 05:18:39 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ClKHnTmR; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of 3rbztYwYKCAQwyvirfksskpi.gsqpmry1-qqozego.svk@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3rbztYwYKCAQwyvirfksskpi.gsqpmry1-qqozego.svk@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676524719; 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=jGkERMphMFi5DTXO6AzCtASC+DQ2dhGXIGrkfltmA+k=; b=7gadOCXjRoG+rVmPvnL+cpcgJfZlgOxBzgs7/obHLyG6VS07UGRz2th1ptQAtuwqBe46a7 Zq8MqwfC9A+7yiBhKzTi8aZpC8EPkEDGTMjsZS650gcrUlwiK/m1apAfq1a/GFwO+Qo1IB de74gxuh7/UcnCAJCs0p9mXaptKEI+U= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=ClKHnTmR; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of 3rbztYwYKCAQwyvirfksskpi.gsqpmry1-qqozego.svk@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3rbztYwYKCAQwyvirfksskpi.gsqpmry1-qqozego.svk@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676524719; a=rsa-sha256; cv=none; b=7ePiLx3YohXDWwnn0Oxk01tKcKYCK0wxn0mG4AyOYIId8y2ZYb4k3tyLyCptKxgLHvfOlQ 72efRNcxo+2l04VFsAlsJgzx1KMgeKpdw3n/2Xv09hLFDBlUKpwFUL0OyVTla7iIAJfYLB OV45YbxmNNifHcPYCRvvqoG7/J1KWks= Received: by mail-yb1-f201.google.com with SMTP id a4-20020a5b0004000000b006fdc6aaec4fso843530ybp.20 for <linux-mm@kvack.org>; Wed, 15 Feb 2023 21:18:39 -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=jGkERMphMFi5DTXO6AzCtASC+DQ2dhGXIGrkfltmA+k=; b=ClKHnTmRqrwFsiwdvZoHbs8UrIxrOZcnAlLMKj0DmY4EeItAiZvM3xF/1XkOIILsHj t/ncp3cCJ608udelXLFUJi2J2Bkc4zBNFEFw7AtqnW62B+1ruBsojOMJ+l//Eveg6kMb 9mESDdWGEfVZo4wbqdchVNx7evryh4U8zH6lvFtZPteOd8Fw20lUCwc+q1jxjD4dRCfO fPscX4k3EE8nShVcC7jG6Imy8fv3tD4a5LzQcDPbvgxMAF9FYu61sb1sXCbMYbbYMnzw H0gcnPTwNkiDCSFpe5MW+pIUr82O7ftWGw19nAsT/pwTKfJQo1rJfp9QBdZ/qdttHeJW nqYA== 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=jGkERMphMFi5DTXO6AzCtASC+DQ2dhGXIGrkfltmA+k=; b=fYUi6X43BMFFsVGcjg6RcFdyhVt4RmhG0zTHmrUO5k3/cOzpdforoZ/2PC3e2NWudL 4bkg7ZlBgXuiZMJEPNT9p8qON11D+g0jskDYWPGWVRizRtyhnwgn/4S6KjMisyg9ek+Q ibX5ib3ZErrhB1oC7Kd3HjI6Ary1JPQlLiDGqhj6FJAzaM+2tW5mEptC9AQipJ9nlruf RmVzlrWfeyC/Vpld3mxvWnIlOfJGrHQEzAGRrTEjl/v0L28wJdA/1tToo0MnMuPYQ3ci j951H7swodi4yrFtMoV8CcytlmbyTMR8a+ENIZTibvky1kO/G5eWBWNSOiqEw7Jk/4+v Bhiw== X-Gm-Message-State: AO0yUKVP2UiHRBA6BbDYkhNc6wxUSCCBvonRmAoExSigzom8qfEH78/3 JRoeyY3iefg7ZJCNIPypgrugGcpWbq8= X-Google-Smtp-Source: AK7set+tNlKzQOXitoUESk90msiy2FCUMsrjKiA2Q/PTOw27FiKf0wEmZgQspJdrm7P++s7G3RI15C4Nebc= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:f781:d5ed:1806:6ebb]) (user=surenb job=sendgmr) by 2002:a81:ac54:0:b0:52f:45a:5b00 with SMTP id z20-20020a81ac54000000b0052f045a5b00mr11ywj.2.1676524717784; Wed, 15 Feb 2023 21:18:37 -0800 (PST) Date: Wed, 15 Feb 2023 21:17:33 -0800 In-Reply-To: <20230216051750.3125598-1-surenb@google.com> Mime-Version: 1.0 References: <20230216051750.3125598-1-surenb@google.com> X-Mailer: git-send-email 2.39.1.581.gbfd45094c4-goog Message-ID: <20230216051750.3125598-19-surenb@google.com> Subject: [PATCH v3 18/35] mm/mremap: write-lock VMA while remapping it to a new address range From: Suren Baghdasaryan <surenb@google.com> 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 <surenb@google.com>, Laurent Dufour <laurent.dufour@fr.ibm.com> Content-Type: text/plain; charset="UTF-8" X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 68973120003 X-Stat-Signature: 7ku4xnp8aw6t4mhytg5itjotzzmwtt51 X-HE-Tag: 1676524719-941465 X-HE-Meta: U2FsdGVkX1/hF2OxMMRPHS9wBVrJdTvRdLFAPUaWWBrvWxqSdGMlYP9VARYJY0KW90i1WobzcKvMBlGWUX00ss9Nr7T1WDs5Vmc3SQqkB2+cnncFyykFOKOPEsRLvYvtvUwXTQtR65H68zrCyomyf2QaamwHD+WpcM1/l1oZmi/ugqfbH7hDRrwaSODORiuhohxCllEWr3j9t9PyHfHxI4dZrRdznVwjjlKX8PSm6PLb+MW8XN4nqNqu31Vv5I4SeJaveymSu2DgvXo8zqQvkf09oVY3pHE8Wd/psvcCxMYAoGoqwr2OAq8lb3aRGjxNsKs2EBszRWWYIcm0DKqwrsd9Z2IM1e3MVUuyl7PAGQO2sxuJ7PxF7ejgiG4p+7Q5NkfDvBqJzIckNBS1+BQaVjb+Lt6JcJLGXRdBvy7dscogxtkHp8959Cno216/8x1sf+vcBBhFLnei+IZ4IC4Ln3zx1HO46kMTnBtV3d3LECE64Sp4HUpDlCZXLjGWPfbliZYDPYCt6TEd1EYMwhZsyZnzYYFx/8EHmuz/3P+h32Gbherhhe296CAeQC6yMEhy/Dm9Iduaw/XtMuskX7puhBzRf+uQdSftrQLF399lQCLurn2XSCc+VYpUCSH1gAByjgu/8XUz9y+7ZXLpcpEPhgDlSZsv1t+yT3X2Lr6XalybuYDmuQkHOfb3kGXoKTjDF0No2TDEJvlZ5uxi5crbygAogEFeRekSU1yqajsYjtvOlphApZjxlZQlStaWLnTze6kLiTXHIc9yR5AZDnvkIkk40nL9mYGQ4QMvoidqeTwcnhmjniTBswMq5e+2q0SuawpO9g7ArlXBZ8uroNfcJh/QDwH7Q+CqNlxIQzYxLHDsyvr3YOD/D7uHg3o+sgRH9GuGEUrTS8R9K4e8Oj/9UCzYtG4dhfG02zuQbJibNb5jEa4kzloHRxolgZTNwyKVE0s9ssK9VaBA9M0Ykba 0hL1grP8 zgLvWro2ZHXHnctOxTNkb4N/cth5Es3e+e9i64LCC5xEY2dsgrJIxnLJNa+Y3fpKoYCmBWFHTJAHQvQWgYB79hTYPdNozy6iOlqMWm/TUTOA2pOe1v81AbKIB9F5vAzv6wx+Zyv2cv0NeNPc3wJvQYhBHL8Z3Lf2igjUn37da2EAucvJFxoG6nKAaKrshnlEJouhRrIl7XCH2/MP/YKDVl22pXtOYIW7tl18N3Jzv/D2w2odhgXEQ1p5yTHZwNaEn7usCLN7ozFZLe0/TfTmF8mm1iOQpzT3YHgJPjSLXBJ+GqXVc4sGYM6wSxqXq92cbu4Ynd/IO4LQmqt/TaJaDLAM2CRcenQo5hNHibTgu5A8WxrU4nd3MzrQLa8iX/uVTdpuRd47MvlzouT+24TN/v35afPjb8OW6H9xyZR9Z5eFSMlrj9fMiVIRlqpO+kCvx/9pW6xxYN1EcgTf6gvTdiogZjebkWMtwwTtPjejlV4H13/cNbBW29Y3xXl14dyGpxm7YPkpLhrGNpFW4yhvk4Jffi15L6dzvCsZuTlj1YsYfK4wv2W4YQrTKFw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
Per-VMA locks
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index f079e5bbcd57..0eaa3d1a6cd1 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3202,6 +3202,7 @@ struct vm_area_struct *copy_vma(struct vm_area_struct **vmap, get_file(new_vma->vm_file); if (new_vma->vm_ops && new_vma->vm_ops->open) new_vma->vm_ops->open(new_vma); + vma_start_write(new_vma); if (vma_link(mm, new_vma)) goto out_vma_link; *need_rmap_locks = false; diff --git a/mm/mremap.c b/mm/mremap.c index 411a85682b58..dd541e59edda 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -623,6 +623,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, return -ENOMEM; } + vma_start_write(vma); new_pgoff = vma->vm_pgoff + ((old_addr - vma->vm_start) >> PAGE_SHIFT); new_vma = copy_vma(&vma, new_addr, new_len, new_pgoff, &need_rmap_locks);