Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp48538rwn; Wed, 14 Sep 2022 15:46:56 -0700 (PDT) X-Google-Smtp-Source: AA6agR7n2mr8VQ1OqeDYglxZr/GmcaapUCi7aw+l/AWrI5EipU27GehOPvYGwcSdoICNFHkr1rYQ X-Received: by 2002:a17:906:8a45:b0:770:26a9:a99 with SMTP id gx5-20020a1709068a4500b0077026a90a99mr26826116ejc.47.1663195615996; Wed, 14 Sep 2022 15:46:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663195615; cv=none; d=google.com; s=arc-20160816; b=madDm3F0ih4ZqRjNz5GTcphMFB/5S8IhPoln1uCu8HDmz4NQV6GJKxYG5WZiiKsG14 mnPOwYWDiEyVBl8tyzuBUwKiyPRQvq+jAl1o8mN4xl3RsSrv8Xxs1Oyi3UndCKudlwV4 +Hms0CBfkEF+/T/Es+TeFupPL0VIKLtGdRZrLq6efZp6r7ZeLbNB8wvIl38yu1hbNH55 nhIB7+kTM4ZqqQbIeRO25EXZdCv5kDh9kXPYC/OjSmFpKKpuK+EeuMZnb4rimh0ISEQB AE7tKHlkZ5dHsgiuseJ23cmSB3+/gupHu9t+1vXi3fUcQgLC+/uddzSf/hYA3nOvoYKN O3Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=OO9cwt5k8sVnjLdqSV7ImgJVM7V/9Yp3/23q+Xzx5dg=; b=Pbq563B8z1WgNWdXyRMNwN83CIce8LlBMTDHQLW36sWUdtoD9VQza0dwYznWE0HLnJ /Lml8j0nOpf6w2hv3BrVW9fDy3U1fTku7b0wQ2IPuKfjQ6ga6VwV6dBLH4fjqSPeEbC3 sqOWBlAT2l1515hnbCUpBtA4/FXPzDyPQZV2KQf7ogXbvup+bSSgCGSx0Ju3QHRgqN3X 0ad0DYjMqf5hou99oQTFjdfBZP7Os6MhC40y+5mQMahn61HWzEw+Dx8aWUiLgO8+1bQH qtwsDQSr0ZyTmhAMsMrD+9PgW6p+ZM4K3V5u/BIpaj2R4oPP1p3r/lgNdBpSiBrwlpA8 n3nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=tcXAs+Re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a05640234d200b00451cb1dc468si10775170edc.47.2022.09.14.15.46.30; Wed, 14 Sep 2022 15:46:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=tcXAs+Re; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbiINWme (ORCPT + 99 others); Wed, 14 Sep 2022 18:42:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbiINWm3 (ORCPT ); Wed, 14 Sep 2022 18:42:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9D168052E; Wed, 14 Sep 2022 15:42:28 -0700 (PDT) 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 82ADFB81CFD; 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 X-Spam-Status: No, score=-8.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.