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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90910C6FA86 for ; Thu, 15 Sep 2022 08:11:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC6DA6B0071; Thu, 15 Sep 2022 04:11:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D76E16B0075; Thu, 15 Sep 2022 04:11:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3E488D0003; Thu, 15 Sep 2022 04:11:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B22006B0071 for ; Thu, 15 Sep 2022 04:11:34 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 924A540C2D for ; Thu, 15 Sep 2022 08:11:34 +0000 (UTC) X-FDA: 79913600508.11.BD947FE Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf04.hostedemail.com (Postfix) with ESMTP id E50D5400A3 for ; Thu, 15 Sep 2022 08:11:33 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSqZ52WcdzmVPZ; Thu, 15 Sep 2022 16:07:41 +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; Thu, 15 Sep 2022 16:11:27 +0800 Subject: Re: [PATCH 08/16] mm/page_alloc: add missing is_migrate_isolate() check in set_page_guard() To: Oscar Salvador CC: , , , References: <20220909092451.24883-1-linmiaohe@huawei.com> <20220909092451.24883-9-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <8a23c1b4-494e-1006-ee8c-e27a798d9f8f@huawei.com> Date: Thu, 15 Sep 2022 16:11:25 +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: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663229494; a=rsa-sha256; cv=none; b=8PpTdX4REiRTRdS9Ipy84RWeAOWUzsgeYqDhAWVKBmA088e6qogRdaRahvkUQHKkPYPfLa BWbbcLFzbw45290uadmmZB0I6HLrgLr5N0hRgu5PoLtumMC4/tey5QkXj61RgWhrD7PzUu QEPiR/NnKfiV9RMCOsXeoIWk2tNMyQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663229494; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwEfJuXUPBKuf4yqQzCRxE3/ddjECdyHrgTv5KWSsr0=; b=U7LPW+MQon0eJk3y82yUNZ22p/+ybDL1QG6GukFaOFUJE7cXJJtUnS06WoqeTCpZcVkx3J PlDmDkmMI+9bJvkZNd11J404dqD0FEIvdgWDeyIuALMnh9Y5r5+totuPFoqy+zGO98Sb3N 31T1hG7BKwPLeNCIdHitIkl+H4zA8/w= X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf04.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E50D5400A3 X-Stat-Signature: mxbshsf8ea375nuen1t8qj7co4eymz8j X-HE-Tag: 1663229493-432722 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 2022/9/15 15:26, Oscar Salvador wrote: > On Fri, Sep 09, 2022 at 05:24:43PM +0800, 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 > > Ok, I gave it some thought and I guess it's safe to assume that this would happen if > someone isolates the block, and then we face an MCE failure/soft-offline on a page > within that block. > > take_page_off_buddy > break_down_buddy_pages > set_page_guard > > will trigger __mod_zone_freepage_state(), which already had been triggered back > when the block was isolated. > > I think the changelog could grow fatter to better explain the issue. That will be really helpful. Will do it in v2. > > Reviewed-by: Oscar Salvador Many thanks for your suggestion and review. Thanks, 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; >> } >> -- >> 2.23.0 >> >