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 X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3BD9C433F5 for ; Mon, 13 Sep 2021 12:37:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9A8D760FF2 for ; Mon, 13 Sep 2021 12:37:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238855AbhIMMik (ORCPT ); Mon, 13 Sep 2021 08:38:40 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:19966 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236325AbhIMMii (ORCPT ); Mon, 13 Sep 2021 08:38:38 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4H7Qqx0JDkzbmTx; Mon, 13 Sep 2021 20:33:17 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Mon, 13 Sep 2021 20:37:21 +0800 Subject: Re: [PATCH v2] mm/page_isolation: don't putback unisolated page To: David Hildenbrand , CC: , , , , References: <20210913115021.27597-1-linmiaohe@huawei.com> <6a096a23-83b8-139d-b2dd-87ea3e405050@redhat.com> From: Miaohe Lin Message-ID: Date: Mon, 13 Sep 2021 20:37:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <6a096a23-83b8-139d-b2dd-87ea3e405050@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/13 20:15, David Hildenbrand wrote: > On 13.09.21 13:50, Miaohe Lin wrote: >> If __isolate_free_page() failed, due to zone watermark check, the page is >> still on the free list. But this page will be put back to free list again >> via __putback_isolated_page() now. This may trigger page->flags checks in >> __free_one_page() if PageReported is set. Or we will corrupt the free list >> because list_add() will be called for pages already on another list. >> >> Fixes: 3c605096d315 ("mm/page_alloc: restrict max order of merging on isolated pageblock") >> Signed-off-by: Miaohe Lin >> --- >> v1->v2: >>    Add VM_WARN_ON to catch unexpected isolating failure. >> --- >>   mm/page_isolation.c | 9 +++++++-- >>   1 file changed, 7 insertions(+), 2 deletions(-) >> >> diff --git a/mm/page_isolation.c b/mm/page_isolation.c >> index f93cc63d8fa1..f67c4c70f17f 100644 >> --- a/mm/page_isolation.c >> +++ b/mm/page_isolation.c >> @@ -94,8 +94,13 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype) >>               buddy = page + (buddy_pfn - pfn); >>                 if (!is_migrate_isolate_page(buddy)) { >> -                __isolate_free_page(page, order); >> -                isolated_page = true; >> +                isolated_page = !!__isolate_free_page(page, order); >> +                /* >> +                 * Isolating a free page in an isolated pageblock >> +                 * is expected to always work as watermarks don't >> +                 * apply here. >> +                 */ >> +                VM_WARN_ON(!isolated_page); > > > Didn't we discuss that this can never happen? > > In that case, the patch description+subject needs updating and the "Fixes" line would be wrong. > I thought this might need a Fixes tag... Will change all of these. Many thanks. >>               } >>           } >>       } >> > >