Message ID | 20220829212531.3184856-13-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 8677FECAAD2 for <linux-mm@archiver.kernel.org>; Mon, 29 Aug 2022 21:26:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C314E940010; Mon, 29 Aug 2022 17:25:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BB9FA940008; Mon, 29 Aug 2022 17:25:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 922F4940010; Mon, 29 Aug 2022 17:25:59 -0400 (EDT) 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 732FB940008 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 17:25:59 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 4C84614030D for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:59 +0000 (UTC) X-FDA: 79853912838.13.EA2909A Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf10.hostedemail.com (Postfix) with ESMTP id 0D829C0036 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:58 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id b9-20020a170902d50900b0016f0342a417so6866713plg.21 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 14:25:58 -0700 (PDT) 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; bh=TWnM2nl+IWV2Xsj5xnZFMNMq0JvYeydCw4P9njL7O34=; b=QxyTYU3FERVCw2VziTt0AktgHLl//+1LB6ej8pZ2s1TWfQT3cvsAWfnuU7caTHeT9p cUZ3ty459UM3cwcXwNVqpzu7fZxDdvEiQ7oppDRkd/R2+Ilj86/8iy+0q3ZJXoZ4hnye zLhHEgIO/fbjIHEiSfoXxsUyX6O+Z8dic5XVruk2KEpor5fjgGmf4uNln1+WOsbYbTO8 1++i5QRJ3Dh2yxyVyOmY5Dm8Y1A3ze3Xt4uhd4NBeKcnHbK+ENDvs3AO4SaOBTp9Wi+f EGkkrDdrwisqruuTTVNnHMbKcZefZFlW3jnAC7mX9edrYOzqBxLpV3pgyWig/2c0mbAr sZlg== 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; bh=TWnM2nl+IWV2Xsj5xnZFMNMq0JvYeydCw4P9njL7O34=; b=g9UeQKViw6kpNOjKgY5SJBdrEesNZfNY0Ik7cPhSNt7zJCQcO7RbnjF84mPSY7dGCj o5TMicqj5x2LdF1vqBkswCMoucjvNJyf1TS0dPzz16R/ypUCRn1zo+CzS0HR94SQtJ1+ pNPv1IoDba3SfBeO2AzzhnnPe99dorAf0IndICgyrzzA3MTG2sF1VfFH2PzNEF65B8Ho nU0mbJrXDv40lVCx9wqNE+/UtOIQ+WjDshfSIUPbj7nEekHuJCZyScLLAHa9Q0o8EmpA xPs8jtZKvVjsPHr+DfgwquSsx031Ce9yl6H5g4hbFskssiqLzy0vzr/0sq7e/KZcT4zc rD1g== X-Gm-Message-State: ACgBeo2KYkDFTRYTVBjIdEv0ebt2KUnRCTV3cSLWfXMvPk4aC+arZb+g wCTcsYvuHyshwh/84IlKzlzLW0TKSV8= X-Google-Smtp-Source: AA6agR76cA5Bw6pPdfILXZxKwAftwtVJj++YaWYUCk6VRMlDSa2HJ+OTsxxi3Jretb4HksKEr9YwTk9TbU4= X-Received: from surenb-spec.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e30]) (user=surenb job=sendgmr) by 2002:a17:903:18b:b0:16e:f09c:919b with SMTP id z11-20020a170903018b00b0016ef09c919bmr18604991plg.135.1661808358173; Mon, 29 Aug 2022 14:25:58 -0700 (PDT) Date: Mon, 29 Aug 2022 21:25:15 +0000 In-Reply-To: <20220829212531.3184856-1-surenb@google.com> Mime-Version: 1.0 References: <20220829212531.3184856-1-surenb@google.com> X-Mailer: git-send-email 2.37.2.672.g94769d06f0-goog Message-ID: <20220829212531.3184856-13-surenb@google.com> Subject: [RFC PATCH 12/28] mm/mremap: mark VMA as locked 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, riel@surriel.com, 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, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, surenb@google.com, kernel-team@android.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661808359; a=rsa-sha256; cv=none; b=KGUpJ62L7aN0T2j+5BWc5lDHLniO3I5AlzDq6w87rFwEo5O9OsvxP2VJ69rFgeBeSy7p4Q ZCMndvfnz2gxStP3PJhzPtR8u8nXN2YMNOJ4KVyRbW+rS2W5gqVQhbQEjLxJFZTz8Bm4ff sUepGl8HZjd61QOe2usz+BSApPgLW7I= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=QxyTYU3F; spf=pass (imf10.hostedemail.com: domain of 35i4NYwYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=35i4NYwYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@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=1661808359; 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=TWnM2nl+IWV2Xsj5xnZFMNMq0JvYeydCw4P9njL7O34=; b=stoh82rsFW0cnqTLOaSalm59MD0WorVsHFoZGPELw1RNz/SfcU4ZmgD/H6Xhs8DNlMct2W CerZEBmP/GzSgPs/1zO/WuUzZyPuCI5mWCd69TM7XiMulyayKsUxnB+Tv+CFoM//7G7kmD vsN9hwumNLhx7auVGvz7NVjDlpj5Ej0= Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=QxyTYU3F; spf=pass (imf10.hostedemail.com: domain of 35i4NYwYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=35i4NYwYKCJcJLI5E27FF7C5.3FDC9ELO-DDBM13B.FI7@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam05 X-Stat-Signature: 1gxmntzgi3477wmcuwpjz8micet7crus X-Rspamd-Queue-Id: 0D829C0036 X-Rspam-User: X-HE-Tag: 1661808358-671932 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000039, 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 proposal
|
expand
|
diff --git a/mm/mmap.c b/mm/mmap.c index ade3909c89b4..121544fd90de 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -3248,6 +3248,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_mark_locked(new_vma); vma_link(mm, new_vma, prev, rb_link, rb_parent); *need_rmap_locks = false; } diff --git a/mm/mremap.c b/mm/mremap.c index b522cd0259a0..bdbf96254e43 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -620,6 +620,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, return -ENOMEM; } + vma_mark_locked(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);
Mark VMA as locked before copying it and when copy_vma produces a new VMA. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/mmap.c | 1 + mm/mremap.c | 1 + 2 files changed, 2 insertions(+)