Message ID | 20220829212531.3184856-15-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 4F6C1ECAAD2 for <linux-mm@archiver.kernel.org>; Mon, 29 Aug 2022 21:26:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B8B0940012; Mon, 29 Aug 2022 17:26:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3CBAB940008; Mon, 29 Aug 2022 17:26:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21D92940012; Mon, 29 Aug 2022 17:26:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id EF770940008 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 17:26:02 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C807414030D for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:26:02 +0000 (UTC) X-FDA: 79853912964.30.45A13DC Received: from mail-pl1-f202.google.com (mail-pl1-f202.google.com [209.85.214.202]) by imf07.hostedemail.com (Postfix) with ESMTP id 833884003B for <linux-mm@kvack.org>; Mon, 29 Aug 2022 21:26:02 +0000 (UTC) Received: by mail-pl1-f202.google.com with SMTP id q6-20020a17090311c600b0017266460b8fso6784600plh.4 for <linux-mm@kvack.org>; Mon, 29 Aug 2022 14:26:02 -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=J1u/YkZ7r4U6qP3j3HXey3MGQlv66sCtBUAUQwGtkmo=; b=bssUgHF5w47sbr7l7KTrCUB9BNCgN6M5weE9wkVgXyWLQuTUzyGpg0OJvcyz0sW5UD jBcbuP4XXvP/J4pS6AqtYRXplk3ioZfRWOizdHfYubwqdaFV7iqu+wCAfN30wOXuSJR5 rOeSjLAnMTV/UMrEb+PillTsGibQBZHi92r8Zd7PRmmwTLk5upCdMt9/ApQU+Kr/zUNy g3HC4+2oFiondWWpmL/CQDHhjiEfoJFEyDpo5hDjW6J9yE1A4zjv6LFdAo5+gh9e4xsA 3B8ihRdAo9AsX2EZ1zty6Setu8LqB98WdsMEL3dnRqIhFnd/9nqnY8Jcva4fprwPuNko 5pyg== 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=J1u/YkZ7r4U6qP3j3HXey3MGQlv66sCtBUAUQwGtkmo=; b=yHtQuQuqRcqlJ9J2CHR3OZ7dxeQQ8SB0Oi9aOIQ5eA+vk+N8Z+cJWbtAFoF0EGpLMk UbrdMf0eCu85AvsL8znrkccQZ8u8hMYfLX7opVErbv/UpVOav9XD92BzYy4wNRURK6xx BCC5j3rN35k05p6G6JrggXXlnlAUeA6BEE6oaRts3HRHnHflCNsMHW8xs2jdMZIqufTs J2lvp0rCVrGvEOWfGFx/cxgmmj2ceWY9FUuIlPlc0uS/ZwPpvIY3wVaKj0n5vXmp6g+J WJb4haXjtLX0JbmxskyIucjFO8/SnueIocF1C/Gf2I7mE+pgqjJSxQ1JdsH3YEFIBZwQ gGLg== X-Gm-Message-State: ACgBeo1prNRMtVo6mAQk40BCTcUFAx2TdF5AQ3of3D33ztGOwkOABlF+ oUjaPpQAafHM0bM2SOvcoOcV2QowPSA= X-Google-Smtp-Source: AA6agR7FrxHuf3ebSGip6Dsrc2j7pCNXLJVmg+GJ9+F6P4LGjbGDMIiC+XxX5XFr/bvFDyLyzfk2y9GLnRc= X-Received: from surenb-spec.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e30]) (user=surenb job=sendgmr) by 2002:a17:903:248:b0:172:7520:db07 with SMTP id j8-20020a170903024800b001727520db07mr18052271plh.76.1661808361566; Mon, 29 Aug 2022 14:26:01 -0700 (PDT) Date: Mon, 29 Aug 2022 21:25:17 +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-15-surenb@google.com> Subject: [RFC PATCH 14/28] mm: mark VMAs as locked before isolating them 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=1661808362; a=rsa-sha256; cv=none; b=YaepYkN2KTgAdfl6sDThOBOZ1ixAG3cvc4+ig5QEXdEn+lE9ZpbpYbFwFgTZiFaWo2nV6Z wjZO4hJtzXlhRMuOV8xIKSyedtopiLYMqjPHEoovTZLF0nFe6trjwGSUA+D53BlfhT7Kl8 Nuv7SvmwdGtAOg+aUnmzELOXe4wfCZg= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bssUgHF5; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of 36S4NYwYKCJoMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=36S4NYwYKCJoMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661808362; 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=J1u/YkZ7r4U6qP3j3HXey3MGQlv66sCtBUAUQwGtkmo=; b=mVpEdyfLMU7nNBliCZh4Wvb6TF/uCGkZSypl+QQGMau+VJubD80Up1u9Cb4Cnq9D2E3gQB /4z4iC9wazug//DLt793bmT3Y7rGxoCa5BF3pjBaBvkcGkGZhbKq45vOx+mXspo9OiMokw 4Ba7OWz+Bk2OXyshLucnM5V+0KF2TIs= X-Rspam-User: X-Rspamd-Queue-Id: 833884003B X-Rspamd-Server: rspam12 X-Stat-Signature: mdcgdekuqwtdpp4tpsu5i8ddc8bzuomr Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=bssUgHF5; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of 36S4NYwYKCJoMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com designates 209.85.214.202 as permitted sender) smtp.mailfrom=36S4NYwYKCJoMOL8H5AIIAF8.6IGFCHOR-GGEP46E.ILA@flex--surenb.bounces.google.com X-HE-Tag: 1661808362-681557 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, 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 094678b4434b..b0d78bdc0de0 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -421,12 +421,14 @@ static inline void vma_rb_insert(struct vm_area_struct *vma, static void __vma_rb_erase(struct vm_area_struct *vma, struct rb_root *root) { + vma_mark_locked(vma); /* * Note rb_erase_augmented is a fairly large inline function, * so make sure we instantiate it only once with our desired * augmented rbtree callbacks. */ rb_erase_augmented(&vma->vm_rb, root, &vma_gap_callbacks); + RB_CLEAR_NODE(&vma->vm_rb); } static __always_inline void vma_rb_erase_ignore(struct vm_area_struct *vma, diff --git a/mm/nommu.c b/mm/nommu.c index e819cbc21b39..ff9933e57501 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -622,6 +622,7 @@ static void delete_vma_from_mm(struct vm_area_struct *vma) struct mm_struct *mm = vma->vm_mm; struct task_struct *curr = current; + vma_mark_locked(vma); mm->map_count--; for (i = 0; i < VMACACHE_SIZE; i++) { /* if the vma is cached, invalidate the entire cache */ @@ -644,6 +645,7 @@ static void delete_vma_from_mm(struct vm_area_struct *vma) /* remove from the MM's tree and list */ rb_erase(&vma->vm_rb, &mm->mm_rb); + RB_CLEAR_NODE(&vma->vm_rb); __vma_unlink_list(mm, vma); }
Mark VMAs as locked before isolating them and clear their tree node so that isolated VMAs are easily identifiable. In the later patches page fault handlers will try locking the found VMA and will check whether the VMA was isolated. Locking VMAs before isolating them ensures that page fault handlers don't operate on isolated VMAs. Signed-off-by: Suren Baghdasaryan <surenb@google.com> --- mm/mmap.c | 2 ++ mm/nommu.c | 2 ++ 2 files changed, 4 insertions(+)