From patchwork Sat Jul 8 08:57:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13305635 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 499B3EB64DC for ; Sat, 8 Jul 2023 08:57:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE3F18E0005; Sat, 8 Jul 2023 04:57:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C45168D0006; Sat, 8 Jul 2023 04:57:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FBDD8D000A; Sat, 8 Jul 2023 04:57:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 7C9308D0006 for ; Sat, 8 Jul 2023 04:57:39 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 59A6DA0147 for ; Sat, 8 Jul 2023 08:57:39 +0000 (UTC) X-FDA: 80987841438.16.A1D05C6 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf27.hostedemail.com (Postfix) with ESMTP id 1B8B940002 for ; Sat, 8 Jul 2023 08:57:36 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688806657; 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=LCrOy4OLsHpFK0OuO84MTfILpCt87VTlpXIdT2mKjQg=; b=AdE1AgkE8l8Z7TQE6CC1Q5uk7XTcXZQTVePbEgUdDB1pUHxszwrfZryRf14jhfxKnuAV/g xHj1IcPiejK9+mImdu4xGm9BCfvpJHrI1pUrgqzf8noE9sld/b3OU/MeUzE4jS0z6OV2RC 8NvfJ4dKU49sy8bQtz2gLBSVEWwRLkE= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688806657; a=rsa-sha256; cv=none; b=PN94cmyLbDxP37YxmboHtfGWKlp9ZVysW4tYPp0OFvzxVH/T8gtX9zY6ZRclpuy3QcgjVC XrGUQ10w6arZgQWGqzsJpZBeQIfYWkiRLxOt6dIcudGWBCWUqoV6gBtHRA3AjTaeBn6DDl 5xVujiypXUeucuSGbx7R4YD2Yuk8xA0= Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QykcL4RbFzPk0X; Sat, 8 Jul 2023 16:55:14 +0800 (CST) Received: from huawei.com (10.174.151.185) 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.2507.27; Sat, 8 Jul 2023 16:57:29 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH 4/8] mm: memory-failure: use local variable huge to check hugetlb page Date: Sat, 8 Jul 2023 16:57:40 +0800 Message-ID: <20230708085744.3599311-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230708085744.3599311-1-linmiaohe@huawei.com> References: <20230708085744.3599311-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.174.151.185] 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-Rspam-User: X-Stat-Signature: 1jttu9ft7i53i7jqm4tuc44r7xpta8ac X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 1B8B940002 X-HE-Tag: 1688806656-720207 X-HE-Meta: U2FsdGVkX1/FSFKVMtUWdYpEDf7hy9otZehY/g2p4SnsnJcj5S0aeW6VlHn/9yUsc/wlcZVHL/QMh2WHcazkU/TGK/k1dnKvXFFxIhsJKeJQx5faVNKHFeB0/fy1y5yL7r7bDquuKFCH3lFIrNAjZrANo8ZAvtNRoPMhe6W0YPJHfzHLrNrwJ7msDDT7ZVdVLWD4hqxKpYL0CSIO1iP89cflO43karP8YEqhsiEykAEtv/Y8+8HuG2fFO4E4JQDRLz2Rh/9TzpEDI/RYy2/flQrMnNQTQY0JouxK2AhlKdzjKdCr6bQbyPrnFqyMcNonBWBLlcgkHI1EY3CtsQa6lo69CZO9l5rd3kihtX+KOAR8PLeI2ud9Wxgxzaij2jphKgzHHfEcjfrhzUNMIGFeQwd+vJvDzJOrctcXpcvHFi3ybNuok92qcE3nJVSY++xFNEApQ6sPmWZY03maeTxYv3CuyKiREh3WJznzzknDU3Ctn2cOYxHYLouW5hj9awrffzEflxDotM6U1rzz8ClRevtlWCZfYeeDnHxObAkShQIXz0h+qetvmBHn2/UiSQ9mEdIpUXZRFJGptjnSiT3646ZFM2kca2AdkCzdrbvEJTwvpfF/jDccHdYAm0wVylbazZmnL98hrNzcBgE1Y9SfKnGBadKjBFhwn4IdX1OfKcm3V9hIEJFMQ4HKDZIslD0FnWE3oO//LyZRkyIrjpCGee1DE+yYM/3Ug4nrix5n6Xm8MFgk6dxSrmPtnH1kqbyOqQ+y8SwRbEPp4g1rcm6d1J+fZjoAqxpBzrxzikFkOGbqekR3ts6d05fYYl13sHpZGGs3ymKYsqkHuTuB3HK1sinu9ndVUeZVOcBJHYw1nkFH7OCHxx+XWRY//SzjNEev1Nnp+d+D4eqZuz0JOa55qdwpu9uLVZA7N9hI788krW7kQWGRoEEyV52vhgEFiuqoFGVOzn8kqGfGSNGcF0B d10bkpiv bN8NOvwzGMF+bSYoAaijxGp/dSVeazYtxd9c250An8rauSYS6tvA5XVXEpxiGgh3Jc5LeFRRR/3r4WMba0SEEoGYli9hF/K1hcO5u1Um19NcQL6+1UixWpgmIX+G6r43DbmIibf1NueRvWrngfWRlU0oWTw== 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: Use local variable huge to check whether page is hugetlb page to avoid calling PageHuge() multiple times to save cpu cycles. PageHuge() will be stable while extra page refcnt is held. Signed-off-by: Miaohe Lin Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 905758af70f3..88e48a4801ee 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2621,7 +2621,7 @@ static int soft_offline_in_use_page(struct page *page) } lock_page(page); - if (!PageHuge(page)) + if (!huge) wait_on_page_writeback(page); if (PageHWPoison(page)) { unlock_page(page); @@ -2630,7 +2630,7 @@ static int soft_offline_in_use_page(struct page *page) return 0; } - if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page)) + if (!huge && PageLRU(page) && !PageSwapCache(page)) /* * Try to invalidate first. This should work for * non dirty unmapped page cache pages.