From patchwork Mon Aug 29 21:25:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 12958505 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CAE57ECAAD2 for ; Mon, 29 Aug 2022 22:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Uh2lQQ1tkDjh/3G8MTqTJSXgUrs57YrZXxNl8dsOT7s=; b=bTVdSdgf63fGf47xgpzPYAJoQ6 dQSr7t93lIpct+p124GZwGYZKz6m3qfeH+U7taW3Qw7pnOQij3q8+b8ZaHnj1stRP7a32G83mu/8c n95JsCJ5jDwtaKF14KKTES4ny2egqTesdUVUN1owv1iUE70T/CCuIONluyV+fuGuE1csiXW6BCHRt 0ceBud0InV+Sg5leesccBIWJ/U0MEvPT9eBqOeuQlXIBXXaDdpV6CiCGg8SCdVTftjW0p/FpAs+Pn BBPqvIWbiYOazHaQTQMLNPuYQiZFd+J5/QuNrbRvyrqZXHgbWIivk/eMlgwxGeJd2K/w/fuKWjH5z Uy17r1Bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSmmz-00Cy24-Ph; Mon, 29 Aug 2022 21:59:25 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSmmU-00Cxud-Ei for linux-arm-kernel@bombadil.infradead.org; Mon, 29 Aug 2022 21:58:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Cc:To:From:Subject: Message-ID:References:Mime-Version:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ooNZAin4dExMhxnzVFEqRWXW+87JR2sLE0fevcXKZcM=; b=C6Rm8LMXvxT3/opGXC4l10pLJY 9lKJ2e1q9Ma3eCcQkLKiuWFkVR6ya+0WhWnxVMu5m40h3qy2wgyyMhuXdZHQUKlJIiF4wOlUkNlTJ V6ohE/4WPrXfC2dfCCn5wVht9Qjbon66AZZZ5TSfRQ7RID4eppZ7guzD024EJhtij/fMopdk3ekf9 rT5JMMkHuaETJhIL50lJGLvlZn3v8q9RF7zM9fLTqDQovGnF99r+ELK+x8HxvQ+dLAvh6RfsSdqww +T1TNY/UYSfwjdWJw7QoDJrHxVRoC/q96XyYjC84VPv5Wfx/wGDonRy0z7Yyn5TAgML8sxfcNTOQ4 UWAVy9KQ==; Received: from mail-pl1-x64a.google.com ([2607:f8b0:4864:20::64a]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSmGX-007bbD-Ji for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 21:25:55 +0000 Received: by mail-pl1-x64a.google.com with SMTP id m5-20020a170902f64500b0016d313f3ce7so6864493plg.23 for ; Mon, 29 Aug 2022 14:25:51 -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=ooNZAin4dExMhxnzVFEqRWXW+87JR2sLE0fevcXKZcM=; b=I4AROHhc91xv1qcH3nCi9ZpRLfIZ0YYOknUuCx0UCVegrJDEOhp2xXx6sXe9aCLn1C FzO21jqONtvqpljlp8Pb4Y+CdSx9zRBCbsYcOU1CMA6tT/zAnvmRorbY0bmK2T02uMkI Atv+IFZLAVnvs+tVzbF09RqlClFEsd0HUKtTSkQ+YRbpf3d4jB4ZfuXvxVp5TLyaLLyx AxdLnxV0cUJcHwzUd+Lxky4P92oXj4Xhl4or9fJrlsG5GoIvzarsCtdrQ2b29IJKR80y NIBWQdZUPTZNVXZAtYrsTzYsNpAhtyZg3hqM9pNuOBs9nY5UdbnMfXBZJ7yLdA5TAp1d MxBA== 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=ooNZAin4dExMhxnzVFEqRWXW+87JR2sLE0fevcXKZcM=; b=8B1LZ05rXWAt3OsZwwwG9Wsz6NPLPLzmHms3p22LlTFYzse/wNC4J7TjjThDnQERGl 1745S6Qe4d3JG/vQ5pE/KhcN9XTheKmzBNvpRZ+NRb541JU0gTQ27bOERRNGRW7vpMd6 cObbo6SEKXqrzIad4B0ruv+vLLLvXaJmpEWdMQFwlfgZSIHvBkUd2RqumV9prlbJpkED F4ONR95krPFCQeryuilxsMMCcAzZsmjadnLUM0Qyyac52YKLfB70eRjCgpNw1tS58K+d 4jMEeUukWI63Oe3qac7Ush/8HQpCk2oZ/gla5Jl5YeNM4EDZ1qEBYjOHSEKIzKoHqXIw OalQ== X-Gm-Message-State: ACgBeo2nzntEnk9UDeU1eF0WSSDeneLCOwY0+vqOsdX05/1NxK40ZQVa 6ZhcR6ujg1D+iuMrgIaQn3FEzQZZQfQ= X-Google-Smtp-Source: AA6agR6Ch+8H2P4ZiI/nyVX9BprKXIg4wSUP+mENwsodRVHrGORNiLr4bLOGgyZYxzbEnnQphTeE0ezRPcY= X-Received: from surenb-spec.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:3e30]) (user=surenb job=sendgmr) by 2002:a17:90a:4607:b0:1fa:f794:2c0d with SMTP id w7-20020a17090a460700b001faf7942c0dmr20939608pjg.24.1661808349897; Mon, 29 Aug 2022 14:25:49 -0700 (PDT) Date: Mon, 29 Aug 2022 21:25:11 +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-9-surenb@google.com> Subject: [RFC PATCH 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@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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220829_222553_913095_4C3C97CA X-CRM114-Status: UNSURE ( 9.20 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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,