Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36339612rwd; Mon, 10 Jul 2023 22:52:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFf0M+VHa+AXT+lJKhWV3K27NbNUBAHoQvMHGGM/oRYiIx/Y/F4grFylFv7SwbI+dFjghJP X-Received: by 2002:a05:6512:360d:b0:4fb:8ff2:f2d7 with SMTP id f13-20020a056512360d00b004fb8ff2f2d7mr10032970lfs.45.1689054748544; Mon, 10 Jul 2023 22:52:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689054748; cv=none; d=google.com; s=arc-20160816; b=Ya1f0b639uPlcm9cNuiMnxhTfQCuQOX0l5wjcHhmsomQT38nRKduNSjMDEOdGPWXmU nRzrPLG7gmW0kd2JBtENDyqzZVPXk+MxksPJlocKJ0H9tsybl3kFoZJRrh9UoK9hhdi+ agdt+iFgWU5vOMTiqIsXbap2IXY8nt5EvW9JFxKPDDDfRhFtGlIXRJRg82eEI7ngQW9x ojHtfb1dF/xoMlCcIRaBpI/DSthP8oDVS/Hm1JoUwJnLiC3A8qslN6s/+UXQ4Yixj+F2 AB1uAs3lpMApdCq7O0t9UNodwm82I7olkxzcVxoMP9Vev4hTj0IkNkArJT5yzHUgcqqQ 4mmg== 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=gxGZdWW+Li8qkcIOgXs3wSne6UlcSLwoVWi8V/kJIQo=; fh=4o7DIXI/66oHEW09L3854GeQKXh9nrvBy5ZxENMFBvA=; b=COS+OrUNoch6nNTV4Rqz+jjzTnvuLZDLR2ZB1JaVU5cEoQcoDEptgFl/imHcjhuWRX BTdzcuxGF0eiUSsrWMKBK/X+h8m2ayo0mIKHp/pPuEQflVefxzOw6U87ucTdfRfHC8R1 8CEviDOwg3ZuJq/jOud9HGq6kvvDSVGR9ZU73zYAy/xsSBWWuwQccPLmx9A7B5QIuhJn NMaPl7keKj3QIsSMlRTE34KwB1dZ1SQnPFIpknpfO4zfZyJjN55OpNLHYzMc+zF5+EDK +Yh7wApFpF96m2+craZUtO+/i2qhg+CDcvqpqmJildmeAhSK8gLL1EnNy4CQvJhOHAs1 WP6Q== 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 j20-20020aa7c0d4000000b0051e242852fasi1239397edp.584.2023.07.10.22.52.05; Mon, 10 Jul 2023 22:52:28 -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 S230254AbjGKFuR (ORCPT + 99 others); Tue, 11 Jul 2023 01:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbjGKFuH (ORCPT ); Tue, 11 Jul 2023 01:50:07 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B1D11A7 for ; Mon, 10 Jul 2023 22:50:05 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R0VHV6bLdzMqSB; Tue, 11 Jul 2023 13:46:46 +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; Tue, 11 Jul 2023 13:50:02 +0800 From: Miaohe Lin To: , CC: , , Subject: [PATCH v2 4/8] mm: memory-failure: use local variable huge to check hugetlb page Date: Tue, 11 Jul 2023 13:50:12 +0800 Message-ID: <20230711055016.2286677-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20230711055016.2286677-1-linmiaohe@huawei.com> References: <20230711055016.2286677-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: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 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 c80b7d9505d8..239e0711f832 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2628,7 +2628,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); @@ -2637,7 +2637,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