Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp32952900rwd; Sat, 8 Jul 2023 02:13:53 -0700 (PDT) X-Google-Smtp-Source: APBJJlH9aa+3TRmVj5astd49H934Q3lhiNI5mp0RmCFpfKkNaQDjtaiANvB7SZMepY82wUun9ot4 X-Received: by 2002:a05:6358:4311:b0:134:c373:fef1 with SMTP id r17-20020a056358431100b00134c373fef1mr8950531rwc.18.1688807633289; Sat, 08 Jul 2023 02:13:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688807633; cv=none; d=google.com; s=arc-20160816; b=t8VpDSFen3K7jMfyl34rlC/4Uu98cjusRYfXKX+bIzI1eTFXJa9WH/XqszPouKx4sI RK73p3/yZOt7px0E2THfW+ieX5yw3r4mgkWyCwYHvkh4V22eGPbHyYBiV/1o1kCWPZtB bYpn8HH8yI3cKAYp7vO5O6Q4DDi2lQqzcxg7o9YA8cGvoDNPy/BrC6dNxEUrFG1hTM0y TyRZo7L4cIpzrN6gSRTDwAwzGShnELbOuM1rF9e9VPBBpEk4aK9lJLewJ6HBUegPrh/O ur+Fhr3dz+t9H1Qvw7GgrPU7093uU6yjNAcdEw63Nxc4zo/wQSNY3QMwwuY0/LoDC4h3 ZrvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=LCrOy4OLsHpFK0OuO84MTfILpCt87VTlpXIdT2mKjQg=; fh=4o7DIXI/66oHEW09L3854GeQKXh9nrvBy5ZxENMFBvA=; b=ZYZ8d4fOt0HRsf3TrYLsob2CWfaW+7Cw8zrXud2khp220mK0stNePC8XUhz97ULO3U MHwqCfmwd4+pSWaRDqMnDZC4oTPZe0Qin7gfnDpAxTKbjizw+m7B0s8JST0wZX0Zmc9d ywnQWZ+iod7nCpR3t9Hrheh6HVRDICBQZWYI0MmYbKVhHw6WPILDatjgpMRnTeojx47w MN8M78YrRVFd/A2OnRVfMm+iYfattixNkb0ag83pZVKVTbSP/aaO7HGwAeecDuo0Q0hd 7nOsTj7gshd3x5rawTNQTRxwVKlhjUw9zeuIpWmGp3dl8cly6/LQyiWvAfiOVOvBC5Mm 18dA== 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 w1-20020a170902c78100b001b53913a63asi5233888pla.31.2023.07.08.02.13.34; Sat, 08 Jul 2023 02:13:53 -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 S230163AbjGHI5i (ORCPT + 99 others); Sat, 8 Jul 2023 04:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229867AbjGHI5f (ORCPT ); Sat, 8 Jul 2023 04:57:35 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 881281FF6 for ; Sat, 8 Jul 2023 01:57:33 -0700 (PDT) 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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,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 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 --- 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. -- 2.33.0