From patchwork Thu Sep 1 17:34:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 12962974 Return-Path: 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 5E463ECAAD1 for ; Thu, 1 Sep 2022 17:35:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E12E18001E; Thu, 1 Sep 2022 13:35:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DC0978000D; Thu, 1 Sep 2022 13:35:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB02D8001E; Thu, 1 Sep 2022 13:35:43 -0400 (EDT) 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 BCD0A8000D for ; Thu, 1 Sep 2022 13:35:43 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 9684612103A for ; Thu, 1 Sep 2022 17:35:43 +0000 (UTC) X-FDA: 79864218966.27.CD09115 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf14.hostedemail.com (Postfix) with ESMTP id 4E24A10003D for ; Thu, 1 Sep 2022 17:35:43 +0000 (UTC) Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-33dc888dc62so234876897b3.4 for ; Thu, 01 Sep 2022 10:35:43 -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:subject:date; bh=sXPRs4un8Hv1KgYmIkiOTpDZHlwje1UN18vDRt/znXA=; b=LBJTSzoCXGb4iiWKyO0OEdlY4M2wMr4mJ5fdr9ss+SWylmfoHLBZ3bDcjUEYCuu5eS feBNbsez+RUGQT+LSEIL3jhNfGQ3mzrdU70gDdYtaUSlqG4c3zRWe4jgoZRdVjvHQEvZ SPCTeif98/8TgsTaO2lykBXQO/Ydnr0/XtxYChsH6bMYMfoCTEgHM9QVPOJS0Mu1k2UR t6jxn7uXNz4Ix/YY107csqUZ1FzpL1YUPLT0wcSHa5tJ7jOlfkB6DfkgR6ONkj0xZI4Q CdDjSBazMRaOu6i4p9xpWVSdGu4/KGHF+Yxu3Dy4GMEd28lc2vp55tWuelmW724hNsiA vxOg== 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; bh=sXPRs4un8Hv1KgYmIkiOTpDZHlwje1UN18vDRt/znXA=; b=06eSvHg/4Uk2JcgzGO6kwWQcW85pj/OFnCEq+F5SNyaL0sOmUqeAKbfjqxteMWfgIl 6nuazlP+tNneLYmpIVXaMpxkoR4GuJgzMt3RsNtRx627BUwffXE63lhU/WhT0/GN3GkY 5lfJcnq/sE+UKfsNvJoMuJDZqYObT2B+EuIIW01X+TU/GGdJmuREncJlBTExOwZv3ZpK r3MK8dUFwAlDTFHDqHlyxOw1t7l3FdOekrhPrAkOczRpEmozMRe0Dg1rZqBywKxXSg/V kvjieRf4EJptDNy9VvDnhicvdWs653Tz5OUgVhYnLUpfoayuYWh6UYEqOoMIIjtnC8Tz BbwQ== X-Gm-Message-State: ACgBeo0GpbzKmIpjD3bGjPDRZqEhEiaWjp7dzHPwGG/YCJxdgb4NYJ4O W8L3oclFeH6EwrnMvTVkwcw0EwJYdaE= X-Google-Smtp-Source: AA6agR4Ppy4TlAx5Lt/45OnUgJ5yxX2999apq2x6zNaCId6+AMBNoDmW6LxkNrA1Ax704mp9y4OtGqUy/dg= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:200:1bfc:e7ee:6530:4449]) (user=surenb job=sendgmr) by 2002:a05:6902:120f:b0:676:aaa4:8434 with SMTP id s15-20020a056902120f00b00676aaa48434mr20939193ybu.218.1662053742565; Thu, 01 Sep 2022 10:35:42 -0700 (PDT) Date: Thu, 1 Sep 2022 10:34:56 -0700 In-Reply-To: <20220901173516.702122-1-surenb@google.com> Mime-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220901173516.702122-9-surenb@google.com> Subject: [RFC PATCH RESEND 08/28] mm/khugepaged: mark VMA as locked while collapsing a hugepage From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@suse.de, 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, 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662053743; a=rsa-sha256; cv=none; b=cIzIH+SehEA8+60xhoT2ZaKsUCqQaVkO+uwav14gLmY15elmo3f+ggk2zKQEBwB8ejuIDw BdVzVOOWBURVyTy/6e27/GYZMl9zdk99e/6OSLJKugLzNjmhm+sxLkSadX6DE8OOWpy5VE oc8Aav7zEtmd53cWSQeHbik/YBdA3oo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=LBJTSzoC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of 3bu0QYwYKCKsdfcPYMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3bu0QYwYKCKsdfcPYMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662053743; 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=sXPRs4un8Hv1KgYmIkiOTpDZHlwje1UN18vDRt/znXA=; b=CkyXcQW0fC0einm4XjmNl7n/7Px0KmGvjXzSViSHsFd454KkUQnqVJNjz7zLTbJObGmSiW xzKCkJW1TETq9CmSHWD8UisV68n7CMplaqHFjnLhAhVewOlGPuTGLtEAt/hhWPqM3TH6ZF e84MYPoW4vvjzrnTYZckch96ra6Wge0= X-Stat-Signature: rena8hy3ofwcabz8nzygzs964qtuqc35 X-Rspamd-Queue-Id: 4E24A10003D X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=LBJTSzoC; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf14.hostedemail.com: domain of 3bu0QYwYKCKsdfcPYMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3bu0QYwYKCKsdfcPYMRZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--surenb.bounces.google.com X-Rspamd-Server: rspam08 X-HE-Tag: 1662053743-126315 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000043, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Protect VMA from concurrent page fault handler while modifying it in collapse_huge_page. Signed-off-by: Suren Baghdasaryan --- mm/khugepaged.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 01f71786d530..030680633989 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1072,6 +1072,7 @@ static void collapse_huge_page(struct mm_struct *mm, if (mm_find_pmd(mm, address) != pmd) goto out_up_write; + vma_mark_locked(vma); anon_vma_lock_write(vma->anon_vma); mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm,