From mboxrd@z Thu Jan 1 00:00:00 1970 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 44384C6FA82 for ; Wed, 14 Sep 2022 22:42:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B95456B0073; Wed, 14 Sep 2022 18:42:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B43AA8D0001; Wed, 14 Sep 2022 18:42:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0D546B0075; Wed, 14 Sep 2022 18:42:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 925086B0073 for ; Wed, 14 Sep 2022 18:42:29 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 68E15AAB42 for ; Wed, 14 Sep 2022 22:42:29 +0000 (UTC) X-FDA: 79912166418.27.18C0785 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id 19127200A5 for ; Wed, 14 Sep 2022 22:42:28 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7F62FB81B60; Wed, 14 Sep 2022 22:42:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E59CDC433C1; Wed, 14 Sep 2022 22:42:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1663195346; bh=OO9cwt5k8sVnjLdqSV7ImgJVM7V/9Yp3/23q+Xzx5dg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tcXAs+RecZt/TPAEon0Wwu0AJli3XGZ87E8Zl+Er+fCzCctuZRpg5a6MX3gl6Kkzr To9yjEWYSZoWntASAe2seUmwu2yCbQQOn3d48Pc86ecVVXrx1JX1re+pNGiWQN1/nL RahhHaN6JUuQP+oNMzMUWAzSZ4QkuHs4zhlqeDEM= Date: Wed, 14 Sep 2022 15:42:25 -0700 From: Andrew Morton To: Zi Yan Cc: Zi Yan , Doug Berger , linux-mm@kvack.org, David Hildenbrand , Mike Kravetz , linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] mm/page_isolation: fix isolate_single_pageblock() isolation behavior Message-Id: <20220914154225.e3f8ad4b076236c75705b0f9@linux-foundation.org> In-Reply-To: <20220914023913.1855924-1-zi.yan@sent.com> References: <20220914023913.1855924-1-zi.yan@sent.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663195349; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OO9cwt5k8sVnjLdqSV7ImgJVM7V/9Yp3/23q+Xzx5dg=; b=DW+qYopfoAHqJ+0ik8Kt+MBFhu2cRNvpiBTS+eOtQl2lsM8+Fp18RpalRODB/QmSh2vdPF n4ByvsmkWLCw/AhWoqnsk9G5w7aYcnHkX5ClVhp6l7KhUCTnvwM2PDc2RmGEUvOnf/WYUF 8XRU+oa6AX4UsnD+BzXdwiqLIn55y+Q= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=tcXAs+Re; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663195349; a=rsa-sha256; cv=none; b=rjgX9qMAMwCgnFlVjC0tvUi6wwGlhHMYYJ7H5hlg4Kp+5dzobPzqxN/c0//CugE19XzaNq /ukSwamtuVUMTQ4nmms8MGpqAHbsEsVU5sYcPt0YXdJ8CndWTp+PLtkbZItfK8Sh1+aEKC TrtIC5AwcNpq89H0m1y99Mu3LMsQWgc= Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=tcXAs+Re; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: is85brked5byxxyybrtozhwrr9thwjit X-Rspamd-Queue-Id: 19127200A5 X-Rspam-User: X-Rspamd-Server: rspam09 X-HE-Tag: 1663195348-29864 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 13 Sep 2022 22:39:13 -0400 Zi Yan wrote: > set_migratetype_isolate() does not allow isolating MIGRATE_CMA pageblocks > unless it is used for CMA allocation. isolate_single_pageblock() did not > have the same behavior when it is used together with > set_migratetype_isolate() in start_isolate_page_range(). This allows > alloc_contig_range() with migratetype other than MIGRATE_CMA, like > MIGRATE_MOVABLE (used by alloc_contig_pages()), to isolate first and last > pageblock but fail the rest. The failure leads to changing migratetype > of the first and last pageblock to MIGRATE_MOVABLE from MIGRATE_CMA, > corrupting the CMA region. This can happen during gigantic page > allocations. How does this bug manifest itself as far as the user is concerned? > Fix it by passing migratetype into isolate_single_pageblock(), so that > set_migratetype_isolate() used by isolate_single_pageblock() will prevent > the isolation happening.