Message ID | 20220829212531.3184856-10-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 BDE6BECAAD8 for <linux-mm@archiver.kernel.org>; Mon, 29 Aug 2022 21:25:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F01E94000D; Mon, 29 Aug 2022 17:25:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 552B0940008; Mon, 29 Aug 2022 17:25:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 32FD794000D; Mon, 29 Aug 2022 17:25:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 16EB2940008 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 17:25:53 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EC90E14030D for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:52 +0000 (UTC) X-FDA: 79853912544.19.D6C9F56 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) by imf29.hostedemail.com (Postfix) with ESMTP id 981F812003D for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:25:52 +0000 (UTC) Received: by mail-pj1-f74.google.com with SMTP id q60-20020a17090a17c200b001fbc6ba91bbso3715361pja.4 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 14:25:52 -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=tMRmbcwOZDIFaTPxLY27tBFqvxpOSXiDeb2XTcL9iTc=; b=c5Ge838GLG1Fn9WCiifxSW0yY2J286Z3nb7CHVsgQeKl819oavnaneDjs0pHM1pBgc 6/VXxA27srsSSYsH3q/5JQwqbG7gvhz/dxlqpfYYnChp/oSAOK1144eGZRxL5H4xfU4+ gXjPirwbsBHls6abdkbd/Ru5neoY+5POLJLE67tmQyRoTq3+UExyJwB4xZoCc8lFIPHT 1JLKkVoSr3hMYFs+x98zjjRcyw2xrS1rGfAXHEq+RyZfpGyhDpyGAbYsGbpBS3qHA7OY gUezPbUinXA9UrR8RhJyAbOsAhf2VqCoI/O3T8n1+HeqEuYCNoxrQ8z3jvR4TT/rnWyA atPg== 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=tMRmbcwOZDIFaTPxLY27tBFqvxpOSXiDeb2XTcL9iTc=; b=U8hByuy8hpHPPJizWPP5I69oDnKwGIU4nISMiwduOjMdttnzwrWFE8gnh915YKn6xh vIVMZXCINzGg1gwVy6521er0Z7i/APWnbO89Wncx3WXPgAi75otR2bjquUjBYL/o7hX1 TA+1mtuzI48BcDoKoW3HMsS5/JPtNW8QmkD+Wn1u0RbfIGXkxaZ0EQGog9+rOWY+STxJ yNTxhew577K3hgDoq1baDdTzabIUwTWE4CggC9TvJGSd9t8K48Ent4k2rTaZqR036IyK XRqHBQ06G0cikWtesN9OA7Aaz9VunooMUkq5kJLgt9rUxfLUBlhy/aTIOhwzcLvog377 b72A== X-Gm-Message-State: ACgBeo2pcfim7oMtdpLnxyZSKQe7fZ5yWNTiwM9gRf0SHY3xzsC22gLr aRFS+xrtgiUTb86zUuZLBvaZbnxduRg= X-Google-Smtp-Source: AA6agR6WFXWG6lBERn8fKgbng4pdY7+dFZ275Tti+4gL6MGpsob4z29fC0owAPSMM8vQ0mXhvHK4dQ+aJ1U= X-Received: from surenb-spec.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e30]) (user=surenb job=sendgmr) by 2002:a17:902:ab08:b0:173:320e:3316 with SMTP id ik8-20020a170902ab0800b00173320e3316mr17541232plb.38.1661808351535; Mon, 29 Aug 2022 14:25:51 -0700 (PDT) Date: Mon, 29 Aug 2022 21:25:12 +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-10-surenb@google.com> Subject: [RFC PATCH 09/28] mm/mempolicy: mark VMA as locked when changing protection policy 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=1661808352; a=rsa-sha256; cv=none; b=e0zvIzlGi3f23E1Cl++bOsaPrea5E6Xt0WwWlGwMyf2uqj9AVGkkE9xi4YsA9Ojx1ISGVN NV3nKXhfvXc/PHAWFTVM3ZHtHqx5UaczxqMAGIHBfF8kvsqcZBbFpOxQIHH2nzNIlHCtNi AvRmQZJs7WcgE7x3LzU2/fyWgInM0Zg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=c5Ge838G; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of 33y4NYwYKCJACEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=33y4NYwYKCJACEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661808352; 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=tMRmbcwOZDIFaTPxLY27tBFqvxpOSXiDeb2XTcL9iTc=; b=KNcUPPymQljKyhX3RNOK1g3lsjJf/4bLg+IYMG0zjlvGj68s3XuZxUNBok/hJ/iB8VMFfX jHhidwGJiyrRTWuO4vGn/Daop7n1WZkon/TNxrnOWLPpJuuFQ817oGNzNMcveLVsuBB55B vj/WfrePCjarZh3BblSkvm06osbF0ho= X-Rspam-User: X-Rspamd-Queue-Id: 981F812003D X-Rspamd-Server: rspam12 X-Stat-Signature: t58apet73313hmzbs1fnsjxtbuxa7qn1 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=c5Ge838G; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf29.hostedemail.com: domain of 33y4NYwYKCJACEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com designates 209.85.216.74 as permitted sender) smtp.mailfrom=33y4NYwYKCJACEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com X-HE-Tag: 1661808352-407584 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000082, 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/mempolicy.c b/mm/mempolicy.c index b73d3248d976..6be1e5c75556 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -383,8 +383,10 @@ void mpol_rebind_mm(struct mm_struct *mm, nodemask_t *new) struct vm_area_struct *vma; mmap_write_lock(mm); - for (vma = mm->mmap; vma; vma = vma->vm_next) + for (vma = mm->mmap; vma; vma = vma->vm_next) { + vma_mark_locked(vma); mpol_rebind_policy(vma->vm_policy, new); + } mmap_write_unlock(mm); } @@ -632,6 +634,7 @@ unsigned long change_prot_numa(struct vm_area_struct *vma, struct mmu_gather tlb; int nr_updated; + vma_mark_locked(vma); tlb_gather_mmu(&tlb, vma->vm_mm); nr_updated = change_protection(&tlb, vma, addr, end, PAGE_NONE, @@ -765,6 +768,7 @@ static int vma_replace_policy(struct vm_area_struct *vma, if (IS_ERR(new)) return PTR_ERR(new); + vma_mark_locked(vma); if (vma->vm_ops && vma->vm_ops->set_policy) { err = vma->vm_ops->set_policy(vma, new); if (err)
Protect VMA from concurrent page fault handler while performing VMA protection policy changes. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/mempolicy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)