From patchwork Fri Sep 16 07:22:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12978209 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 5EF63ECAAD8 for ; Fri, 16 Sep 2022 07:23:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 85B388D0003; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 808CD8D0007; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65ACF8D0003; Fri, 16 Sep 2022 03:23:45 -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 50AE18D0007 for ; Fri, 16 Sep 2022 03:23:45 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 28731161ACB for ; Fri, 16 Sep 2022 07:23:45 +0000 (UTC) X-FDA: 79917108810.08.7DDCB51 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id 7A46C200B1 for ; Fri, 16 Sep 2022 07:23:44 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MTQSC111QzlW04; Fri, 16 Sep 2022 15:19:39 +0800 (CST) Received: from huawei.com (10.175.124.27) 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; Fri, 16 Sep 2022 15:23:39 +0800 From: Miaohe Lin To: , , , CC: , , , Subject: [PATCH v2 08/16] mm/page_alloc: add missing is_migrate_isolate() check in set_page_guard() Date: Fri, 16 Sep 2022 15:22:49 +0800 Message-ID: <20220916072257.9639-9-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916072257.9639-1-linmiaohe@huawei.com> References: <20220916072257.9639-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] 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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663313024; 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=eTHkjzvxkq+wgCSfHi6Ff5LmrUqxvT8wa3rEmWdy5e8=; b=Y6+oz9FC+il0RieyntHP7hR0ugUFLiHMjpTomF1o1tEDLv+7jWbY+xu9ax+eTCEerFT1ly q8ACUEyWv22B9pgHz4uQWgFkJghqEgLHnSJua6T0fCC1Fv0MhU3EWIY8Mz8PE2EiRRyMI5 YFl1mFk9jxz5lIY0CbI5nFvIPVJmFC8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1663313024; a=rsa-sha256; cv=none; b=Sa+B/AZUi9qts4xgN9rillfvKVK7O5AKREKUTH9PalMGiwFG2gWFCV7wVnemlhV8Fb9SSD NicyWcfZ4vls+hqNTqqFIjwf6GxtxbmzjDa7gfr4c8dvJMvEv8bEna2A4jK4Wpm/nphvs2 P8ndeUEv5WfuGm0z4v3suuqa+Py0+PE= X-Stat-Signature: 5gjyshtxzf1nsc7p6zbgk3z7erxof9q6 X-Rspamd-Queue-Id: 7A46C200B1 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam06 X-HE-Tag: 1663313024-56083 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: 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. This would happen if someone isolates the block, and then we face an MCE failure/soft-offline on a page within that block. __mod_zone_freepage_state() will be triggered via below call trace which already had been triggered back when block was isolated: take_page_off_buddy break_down_buddy_pages set_page_guard Fixes: 06be6ff3d2ec ("mm,hwpoison: rework soft offline for free pages") Signed-off-by: Miaohe Lin Reviewed-by: Oscar Salvador Reviewed-by: David Hildenbrand --- 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 cad235770948..8fcc905ef317 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; }