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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83037C3525A for ; Wed, 26 Jan 2022 02:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236186AbiAZCRG (ORCPT ); Tue, 25 Jan 2022 21:17:06 -0500 Received: from szxga01-in.huawei.com ([45.249.212.187]:35868 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235987AbiAZCRF (ORCPT ); Tue, 25 Jan 2022 21:17:05 -0500 Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jk6lf0NnjzcckM; Wed, 26 Jan 2022 10:16:14 +0800 (CST) Received: from dggpemm500002.china.huawei.com (7.185.36.229) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 26 Jan 2022 10:17:03 +0800 Received: from [10.174.178.178] (10.174.178.178) by dggpemm500002.china.huawei.com (7.185.36.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Wed, 26 Jan 2022 10:17:03 +0800 Message-ID: Date: Wed, 26 Jan 2022 10:17:01 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.0.3 Subject: Re: [PATCH] Revert "mm/page_isolation: unset migratetype directly for non Buddy page" To: David Hildenbrand , , , , References: <20220117142712.3967624-1-chenwandun@huawei.com> <7d39763f-7fc6-a56f-4f1d-7bce42ff59d6@redhat.com> From: Chen Wandun In-Reply-To: <7d39763f-7fc6-a56f-4f1d-7bce42ff59d6@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.178] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500002.china.huawei.com (7.185.36.229) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 在 2022/1/17 23:32, David Hildenbrand 写道: > On 17.01.22 15:27, Chen Wandun wrote: >> This reverts commit 075782149abff45ee22f27315eced44d02b96779. >> >> commit 075782149abf ("mm/page_isolation: unset migratetype directly for >> non Buddy page") will result memory that should in buddy disappear by >> mistake. move_freepages_block move all pages in pageblock instead of >> pages indicated by input parameter, so if input pages is not in buddy >> but other pages in pageblock is in buddy, it will result in page out of >> control. >> > I was wondering about exactly that condition when skimming over the > patch but didn't have time review in detail. when the first valid page in pageblock is non-buddy page and the page order is not equal pagblock_order,  unset_migratetype_isolate will missing move free page in this pageblock. > > Acked-by: David Hildenbrand > >> Reported-by: "kernelci.org bot" >> Signed-off-by: Chen Wandun >> --- >> mm/page_isolation.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/mm/page_isolation.c b/mm/page_isolation.c >> index 6a0ddda6b3c5..f67c4c70f17f 100644 >> --- a/mm/page_isolation.c >> +++ b/mm/page_isolation.c >> @@ -115,7 +115,7 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype) >> * onlining - just onlined memory won't immediately be considered for >> * allocation. >> */ >> - if (!isolated_page && PageBuddy(page)) { >> + if (!isolated_page) { >> nr_pages = move_freepages_block(zone, page, migratetype, NULL); >> __mod_zone_freepage_state(zone, nr_pages, migratetype); >> } >