Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6232158rwn; Tue, 13 Sep 2022 00:33:46 -0700 (PDT) X-Google-Smtp-Source: AA6agR5YTfk5HgJGRXlD10kMC0b88qdPPJmwIo4OpahqrQrdrEhNjoDs+MaLp0iLF5hlVv/gQMFm X-Received: by 2002:a17:907:a4a:b0:77b:c1b2:479a with SMTP id be10-20020a1709070a4a00b0077bc1b2479amr9256305ejc.109.1663054426299; Tue, 13 Sep 2022 00:33:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663054426; cv=none; d=google.com; s=arc-20160816; b=ZTfO17eBdLxj0JLJwPcOIdUv7R3qQQfnO3XEfQQgL4pG1MDjPg5+7lk+7+uItUGkBf HotsbJ3SLs39EqDeF5kZgbDCxrrJNhVhut/8lv7yqr1VF0FzI9gZS9V3SdEZki3gMqbF BcppbijlCDy5vMtGVhkq7qvTMcrmnEu6snbXAg+z75+UDoTj5k3JUogiA9sYEqBFwAyW p15RsZaXQpuIErpujJ889HfUrwJlvqc0RgX/6SsnHjrXyE8QNbU/tys+bSQDM2/QfVE4 opWGE3rfFtbftHLCf9zznnkTJIM6na/ZiegJIktDeK7xpqLT8T53L/oMJQGl5NEioutq xSlw== 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=FsMgp8H3yem1TD8Vam9cOxGmTC8t5rk7aKXHI/9g2Ws=; b=ydO2fSd/0MUjnETtIh6a2IimeohPk7uQPyjP9p0uERJ0AaEj1OOAS7PDo3T0X/oLA+ 8/A8k6/QDu5UKA2T0NCaUf0oqofb7zQovZZlnrZ7/L7Yj3ov2VMzGRu+gJ3T0uPYZ+XZ v3SKB10rAWwZFMWXTHjrRwzwhVoULAGdy92y+Baxr27yhD5h8Hw12qqZNKDFW84wxhLy 0a1/98NeoJw6sPCGsPgeqItewaP4H/uHBuEUGOqwM8T9YFr7SEpwlNI0fUPGK9vyiCiD NtF+aBPIITkFaPpNmruTa8ruMVmLLO+xElbcXDZPmaGpEjOdihNfCTzrjAKiI0JCqTda Vt1A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a056402190700b0045157918d66si9340088edz.355.2022.09.13.00.33.20; Tue, 13 Sep 2022 00:33:46 -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; 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230466AbiIMGv7 (ORCPT + 99 others); Tue, 13 Sep 2022 02:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbiIMGv4 (ORCPT ); Tue, 13 Sep 2022 02:51:56 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C905056BAE for ; Mon, 12 Sep 2022 23:51:54 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MRYxC58yBzHntY; Tue, 13 Sep 2022 14:49:51 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 13 Sep 2022 14:51:52 +0800 Subject: Re: [PATCH 08/16] mm/page_alloc: add missing is_migrate_isolate() check in set_page_guard() To: David Hildenbrand CC: , , , Andrew Morton References: <20220909092451.24883-1-linmiaohe@huawei.com> <20220909092451.24883-9-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <9b7f63cf-dfc1-a1d8-695d-94f6b1af4512@huawei.com> Date: Tue, 13 Sep 2022 14:51:51 +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.177.76] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 2022/9/9 19:31, David Hildenbrand wrote: > On 09.09.22 11:24, Miaohe Lin wrote: >> In MIGRATE_ISOLATE case, zone freepage state shouldn't be modified as >> caller will take care of it. Add missing is_migrate_isolate() here to >> avoid possible unbalanced freepage state. >> >> Signed-off-by: Miaohe Lin >> --- >>   mm/page_alloc.c | 3 ++- >>   1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c >> index a35ef385d906..94baf33da865 100644 >> --- a/mm/page_alloc.c >> +++ b/mm/page_alloc.c >> @@ -873,7 +873,8 @@ static inline bool set_page_guard(struct zone *zone, struct page *page, >>       INIT_LIST_HEAD(&page->buddy_list); >>       set_page_private(page, order); >>       /* Guard pages are not available for any usage */ >> -    __mod_zone_freepage_state(zone, -(1 << order), migratetype); >> +    if (!is_migrate_isolate(migratetype)) >> +        __mod_zone_freepage_state(zone, -(1 << order), migratetype); >>         return true; >>   } > > Do we have a fixes: tag for this one? > > Can it even happen that the pageblock is isolated when we end up in this function? IIUC, we'd have an allocation in an isolated pageblock, which would be wrong already? For "normal" page allocation case, migratetype can't be MIGRATE_ISOLATE. So it's fine. But when called from take_page_off_buddy(), the issue could be triggered as it breaks the assumption in the set_page_guard (that migratetype can't be MIGRATE_ISOLATE). So the fixes tag might be: Fixes: 06be6ff3d2ec ("mm,hwpoison: rework soft offline for free pages") Or am I miss something? Many thanks for your review and comment in this series, David. :) Thanks, Miaohe Lin