Message ID | 20230109205336.3665937-23-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 E3D4FC54EBD for <linux-mm@archiver.kernel.org>; Mon, 9 Jan 2023 20:54:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EA488E0002; Mon, 9 Jan 2023 15:54:39 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 79AE98E0001; Mon, 9 Jan 2023 15:54:39 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63B4C8E0002; Mon, 9 Jan 2023 15:54:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5484D8E0001 for <linux-mm@kvack.org>; Mon, 9 Jan 2023 15:54:39 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id EEAD1160F32 for <linux-mm@kvack.org>; Mon, 9 Jan 2023 20:54:38 +0000 (UTC) X-FDA: 80336464236.30.977507D Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf17.hostedemail.com (Postfix) with ESMTP id 6781B4000E for <linux-mm@kvack.org>; Mon, 9 Jan 2023 20:54:37 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=AsrsBvZP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3DH-8YwYKCCEPROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3DH-8YwYKCCEPROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673297677; 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=1FpUUiRmr7dBuhWWRB46HjSP7TgY2quKdzRuNf/hqHM=; b=32NBVGgM0vrrMCLU90IsoWj11lFRvJb3YzGH7AtsMScSigw4pFcb2HQjN314tSRkbdSgYQ +iofrPjIVK5TDo4LWkt1DO0aW47p+UKB+PBw8R43x46T44b3oF87cwItyvU45z5TvpCQew C9tRwk91qzwka6BV7TpfRlQf4mez6jU= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=AsrsBvZP; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3DH-8YwYKCCEPROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3DH-8YwYKCCEPROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673297677; a=rsa-sha256; cv=none; b=Di/PdYIpAOLGW1QnZRkE5UWALl2tG6lCQz4DIx8y+rEtau91AB4voq8wcHof51eB/m45WG sZA7DkQEGnFNkmqNb3tSZtyavXRVQw1H65ywY2y5Q7wDvwC+uN/P25cH6vhNrGv43Pv/HM Xbx0JTj880AF7iM+r9bxKti//hFL/Xk= Received: by mail-yb1-f201.google.com with SMTP id v4-20020a056902028400b007b075879242so10390780ybh.22 for <linux-mm@kvack.org>; Mon, 09 Jan 2023 12:54:37 -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=1FpUUiRmr7dBuhWWRB46HjSP7TgY2quKdzRuNf/hqHM=; b=AsrsBvZP9aQHF3L5Nl/u1fB+D2bm7e0YjzSCvgbBaPzVvDqUAEV/bKN3f/FWWFnJld y54pIfCVv+Sf28j1GT6GnDmjTV3QxG0dtIi870ieojG97R1YrLaN1+Hnnh1RqNC6IKhV FDsy8k4m0XBTPaqC3JVLB2amGI721PZ/e3uTJFIVXTdjA/KJiKwGIaizGxyvcp5J8QaW 5xEAO0mZOLLdDxM+ya/sdbkzi1vVwSyWReOOtmKkNqv4WGZ0uHxmN44Y8NrueULgHAw2 BBJ3cZtaXuduG2TgX3HtPnChX2RwWmECLeYtrImIURhb/vK80eEmATn6FHpKHV2WHJD9 N1QA== 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=1FpUUiRmr7dBuhWWRB46HjSP7TgY2quKdzRuNf/hqHM=; b=tCkRRqTNJBJx71USfluXtNxtFwKyW+bPiPKaR5LrX9Wv9lzfLkCGDxm1hPwVYEqtwU PH1GwV3u8vsxp+yekBWnEqUtcPVV1azAt++cEyRP6ueyHSLf/frnvkaeLgu7Vr99HQZJ mIHA0OFMowVAxXmgpd3Ioy4s81e02BMjMET30ww3lAq0P4+fh+o+oBCxGTyDwLu4Iyvs eLFQVgkgD+WBgu3MGOm4svn6HlB1DY9pEWb4OhSH0CDhV25ZH+eoSvdcAQNb2iANzJmg hRHWwU5o7knm8O7TuG9HAtqHmfcDRd2MFqXRBX/O5kMaT+FXdTlewZoI7HUxqw5FP5Mu jr1Q== X-Gm-Message-State: AFqh2krP4Z2EC7j90glCHmoG2mw1AeVRvY5VVceVS2PiPj+ufJT6X2i9 RvyIcXP9yJxdnwqcyYjWP57q2DQr7Kw= X-Google-Smtp-Source: AMrXdXtAgZu+pAoAaYuQQAsM5E55paYeoDQZrstt2b6LAIgKd1Hk/SubADrA5GRLvEWllXjlmSi56GzDLGU= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:9393:6f7a:d410:55ca]) (user=surenb job=sendgmr) by 2002:a25:4646:0:b0:799:3955:201f with SMTP id t67-20020a254646000000b007993955201fmr3367922yba.94.1673297676537; Mon, 09 Jan 2023 12:54:36 -0800 (PST) Date: Mon, 9 Jan 2023 12:53:17 -0800 In-Reply-To: <20230109205336.3665937-1-surenb@google.com> Mime-Version: 1.0 References: <20230109205336.3665937-1-surenb@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230109205336.3665937-23-surenb@google.com> Subject: [PATCH 22/41] 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, laurent.dufour@fr.ibm.com, paulmck@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, jannh@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, hughlynch@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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 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QPbtMru 2edHF2ewykzGsSTWawosJrrU/O+H52YPSBMq83QD+cbAAyUcq1tgy9tVqmyASfbdvoAmynhz8NBd/dbHCTqK8QXnQFVfAKOe3JUMAhK7mBVe/Lk0ugausVVuxWqlLD9UIxYlOBy2gj9cEH/4rUtjuKm6kdaFtriMMlkzW6ZZEQGY4zEuMlTP39rMTIb9k5Q3V4jcE2pNK22oyx7sW2CgTIzHRMXIdxTY1F8/g49R4SS6c5Xs0f5lyEqf4XIzdsh8vfNUQnvzk0V3rO6UwFYccCHGw9TzyWHHDW5q4xHrdEn1wsGKEb78OxQewqaKv1jeLVUGl5J6lRvcsfW/kpyP84BEvIDovBDhcR6nez4oeC21TpFE= 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: <linux-mm.kvack.org> |
Series |
Per-VMA locks
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index ff02cb51e7e7..da1908730828 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3261,6 +3261,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_write_lock(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 2ccdd1561f5b..d24a79bcb1a1 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -622,6 +622,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, return -ENOMEM; } + vma_write_lock(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);