Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp2744810pxb; Mon, 6 Sep 2021 04:34:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDs1A5B4btdiQHHL1DYv9gvAAzL5wgLuuLwzZAWX8GpjKbhllRh+X1Ld5BHvkvIk6gE1Y/ X-Received: by 2002:a17:906:3983:: with SMTP id h3mr13132854eje.249.1630928057987; Mon, 06 Sep 2021 04:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630928057; cv=none; d=google.com; s=arc-20160816; b=d4v5SNJewXhJ+Rca0FDE5uBAhAyl7allAPENDFFgrW+Yff1VQwm0u2SoQ56TRZZLyD gT7f2SRR6q2d1dIyYUInJYptDjWxHOghZvoMkRex2EIdYDTvsl8WtCd/Zr3Dc8tOW9gv uJ58OMdRUBAZWqv9Nf4UfDyL4jMnIyfk6FZjQIga82mt/L6Pi8H2yOA3O1YzOlqUH+yp MEvTo8liWGV0uttmfyfNpYk9LRiFKy+jO3Qr7kFYLbKOTMPrjMqE10tM0oB18Z5hDIcD i21uZYUmtoclvSxawlTdREFF3pmog581Wi9XbH1RI35yTjwJw0mxCAzJnG5fjP96gLkH etgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=kC3lyq5luSQ1wE14RdCTp9147gKyt2GKeS6IV7ARzv0=; b=xhb1esIz38w09sNZhDLIw74vNS0umI9GgmUn7WNVF7aiGaqQp8/S3gQkmbFwg4IO6v 5Vdmpz+gg6Si6ScMAfI0z1JRmL3gywtrUI/KJmQq13FOeJoSopWfEYUwhRP8Yf+dd03U aj/W7Y4vYyzxLPlGPljO7d6hU0RhFjgrBXcjjYFA09XscxHZHCNJHP/d3JGu9r+c5w0b I+YDRzANArQMwjji+zFRADI5GqDJmgSGFUVqnK6Dmd5JIkD22POXjVcRpxWU5sfqnIdU HZ2T8xWsTPiLMha+qzeUCBPYbedqh2lWIBXtgXAx5WIAtPVjwsBOxuamH+PEyLzpOl9q p07A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g12si7964397edy.563.2021.09.06.04.33.54; Mon, 06 Sep 2021 04:34:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235782AbhIFLdh (ORCPT + 99 others); Mon, 6 Sep 2021 07:33:37 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:19010 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231173AbhIFLdh (ORCPT ); Mon, 6 Sep 2021 07:33:37 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4H35kR6x1zzbmFX; Mon, 6 Sep 2021 19:28:31 +0800 (CST) Received: from [10.174.178.100] (10.174.178.100) 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, 6 Sep 2021 19:32:30 +0800 Subject: Re: [PATCH] mm/page_isolation: don't putback unisolated page To: David Hildenbrand , CC: , , , References: <20210904091839.20270-1-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Mon, 6 Sep 2021 19:32:30 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.100] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) 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/6 17:40, David Hildenbrand wrote: > On 04.09.21 11:18, 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 >> --- >>   mm/page_isolation.c | 6 ++---- >>   1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/mm/page_isolation.c b/mm/page_isolation.c >> index 9bb562d5d194..7d70d772525c 100644 >> --- a/mm/page_isolation.c >> +++ b/mm/page_isolation.c >> @@ -93,10 +93,8 @@ static void unset_migratetype_isolate(struct page *page, unsigned migratetype) >>               buddy_pfn = __find_buddy_pfn(pfn, order); >>               buddy = page + (buddy_pfn - pfn); >>   -            if (!is_migrate_isolate_page(buddy)) { >> -                __isolate_free_page(page, order); >> -                isolated_page = true; >> -            } >> +            if (!is_migrate_isolate_page(buddy)) >> +                isolated_page = !!__isolate_free_page(page, order); >>           } >>       } >>   > > Shouldn't we much rather force to ignore watermarks here and make sure __isolate_free_page() never fails? It seems it is not easy to force to ignore watermarks here. And it's not a problem if __isolate_free_page() fails because we can do move_freepages_block() anyway. What do you think? Many thanks. >