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: 13308134 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 4A515EB64DC for ; Tue, 11 Jul 2023 05:50:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9E5C38E0001; Tue, 11 Jul 2023 01:50:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 946F98D0001; Tue, 11 Jul 2023 01:50:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 772808E0001; Tue, 11 Jul 2023 01:50:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 62AB78D0002 for ; Tue, 11 Jul 2023 01:50:10 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1FA9CC011A for ; Tue, 11 Jul 2023 05:50:10 +0000 (UTC) X-FDA: 80998255380.21.4B63EB8 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id 5E336140005 for ; Tue, 11 Jul 2023 05:50:06 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 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=1689054608; 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=gxGZdWW+Li8qkcIOgXs3wSne6UlcSLwoVWi8V/kJIQo=; b=GFSpiL5KPakvcKvhWlmk6ZhDugSZLXa3l2RXVZkD+OWkLZPoiu4KUnR/r8vVJRaMSbrkmf UDiuTyDdx/VAQiVJIVOd4jrgyFV8HWrDrddBSOQmBVLccLUiknTYpasVyQWA+i4F6kLlIC V7+K0nF+/OU8DJ7YfqN4lDRhlGumM+s= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689054608; a=rsa-sha256; cv=none; b=dhR+hOM06j7ihYLGtCNQ1chplpzl1dvOASxyWLy8OkaUiaiJ//oCtfm+OPATwo24whzEdb K5v2Bn0bmOSjq7XLZ5MR9TWoceLK0KGmK5DjhEHGsK9xaYWmeXF91RRQ+XlZSwLnFt1Tep mm0M4xdHqGUuDPzAG+PNV1Zcd4npvqY= 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-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5E336140005 X-Stat-Signature: rao5fmdadi1ywmxcu8xh9akcbusnyuwg X-Rspam-User: X-HE-Tag: 1689054606-407089 X-HE-Meta: U2FsdGVkX18thSU6FVPi+DTOpTUAgFY3vYn0m2woUdLDwQ5Y/Kppeaz3CZS8DvrlMX/dOh1Iw8+c6x8j7PrBL46VNYCuBbX15U0dknkPAZ6x+t1cX6ERZbGqbou6nYlwZu+tKPrudJ7XxBsPzMfNZWK87iC4ruFrEvvYIvqfdDBoGyewafTvzXHCn360169avkYdbdxHnksA3lvXHoZGIj43Ev4IFrzbC2Ss6NzvTNKVMQ8+P0lCG4r4n/l5COfa+jnGTQzXNU7YKF7XQkKtZsRJOTEzWX7mYdWdGcBOTUpiD2hz0bmpNPV9Z4vRcu/vF5jHOvGZnLyrbtrHiOaJ6RbUi1FzucBsqH5l1e04alMv82PpI0IBfHKjWLmEHdpGMaVt0jl7+0+sc+6gB2CyJs7jKQ1dDN1PWvmVAi32WPzIuSZWwKd2vaUEY1bwGzBG0twu+/qYQReDlGYJOYPiiZ7j4OsgA0MTha/tDFFhQ/0txeHnUihpzrfKIfNvDF6+T2tNkkH1Zx3Ym/XYSp6NjsjfWwBWXNfiG2sH47x7QZKbHxRplJ9KP5g+Svr5M21Jpy95/kvcbuLisnZPMkFMF10MzdGwXjpneYQtw3+UTloIwkQJYisxKBEDKM9hZvr7DGQ01tKUCcfa8DIRG3L9p/Y+qcisIot4BreThz5keWSTc7lyhv14xBEHo6DLf034SyavfDmM1AgOeiucTbCi1GtPLEJ0t/P73O1i7tdjpFfu2hmxFBtBke2A9miq96fsEOqQ9ookZXcIZu42UnPeP2XycfDqKwbGVAHQNIKga20c8YTTDKk0AL8SRClCIxlsiRLzBgLgVf7Aj0Za+AnM1Qx8dgFvfSbQ63VIerWvA2pvx7F+jKtypn+GBjfddDz/v8hmCig4nKWj9dmidAv9oZXraxE3sn3KK8vJAN3BOANUsn5z0knk5H6YBQXddI057XTO5FCgBCBHV46JssZ 0uf+OpeS NCiy13HyTebQNulF/0V0Yuty8uqudo8ykGU9bp8AUSMgkI4Kxz1I5zfSBlI7I6QyYJQL4Pam1S6LUD5jprpcGswMHTxaD82ttIsTaTTrlEztlmcIv+DOfLWDZulItiUUw559nYk0ZYdAWWvDVHNmShksNhpFicvy7Awt/1rplpqLyQps= 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 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.