From patchwork Tue Jul 11 05:50:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 118262 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp265168vqm; Mon, 10 Jul 2023 22:55:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlEwMW7l8hw73vuo7PYC24KAMWT/QgR5DuyNoirAoqK69elgKhr3qXrXSSm8nQOZqvwLVV8N X-Received: by 2002:a2e:8455:0:b0:2b6:fca2:fc6e with SMTP id u21-20020a2e8455000000b002b6fca2fc6emr8982743ljh.42.1689054938590; Mon, 10 Jul 2023 22:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689054938; cv=none; d=google.com; s=arc-20160816; b=oGDX3ISOL3YSaV/PxvhEBhAPV5a5XPpS29a/rRNZncpBJvKLnov9jWlIwq6lHEXM9K TPtpjqANcIXHpuY1iQ6rsCzrI1NzqGKS1ALZj16UJie/WEEcnlqGqWPDqdlVw7WGfMap vSVad8x9fG/In0mG0ni8ru6dNFz5bBWuhFgGuIyD1xzeZq6+L3tpOG+CyotW2a1rmunI hTuM8AgdACfwpKg8uwwZt0Pgume54vtzfPdThySYKz+ZgxVXy3fNybPpkW5/6AI+ptzB EXVBKqj5B0zIHsXv7sOdc8mC/C/UbsT3fZLJna0INMue5vTvKdeA+qSCCXwI3UTOPGxK tR1w== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jp19-20020a170906f75300b00988a0d75324si1347464ejb.279.2023.07.10.22.55.10; Mon, 10 Jul 2023 22:55:38 -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 S230306AbjGKFuS (ORCPT + 99 others); Tue, 11 Jul 2023 01:50:18 -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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771102470980644332 X-GMAIL-MSGID: 1771102470980644332 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.