From patchwork Thu Jun 6 06:32:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13687858 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 78B6FC27C52 for ; Thu, 6 Jun 2024 06:36:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BEEE26B009F; Thu, 6 Jun 2024 02:36:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A147E6B00A0; Thu, 6 Jun 2024 02:36:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 866B26B00A2; Thu, 6 Jun 2024 02:36:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 675866B00A0 for ; Thu, 6 Jun 2024 02:36:31 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 20792141364 for ; Thu, 6 Jun 2024 06:36:31 +0000 (UTC) X-FDA: 82199504982.03.2138BCA Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by imf15.hostedemail.com (Postfix) with ESMTP id BE4A8A000D for ; Thu, 6 Jun 2024 06:36:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717655789; 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=t0PC1cXunOjv6Jlbpl3SUPtntDxG2hgV7i49asWRawE=; b=zCAOwmkLrpqqATP+8NsyTtIX1rQ2wiMZWo7QmNe2DN+O5Bfj/gcGZyE/WP8RmanfwjLn/8 QMdujtHgFSfBb7l7s+g8ZsiT9uabalS6G83xp/TiNd7VXvDG53Hhe5SZW/qlapGqYhhyue 12h/uOTIW/liSwcOhzJFT1QO66TbbFc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717655789; a=rsa-sha256; cv=none; b=fWiOhaA3GAAqLRE/PcpiygyCHAXVlMcSfKTppWqMkmfhtqp/xR042/sqNBEOhinnS3vz5D Flv45sIKTNA9gTkWJhJHWvaawszvIot666Ws0RNyrL/RZiLJ3o2VB5jbOxruMEB1I+mUMp 1VYGP8C3am7NiOhKn55brmdjhAJtvjI= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.191 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Vvvdk4zllz355cV; Thu, 6 Jun 2024 14:32:42 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id A018014035F; Thu, 6 Jun 2024 14:36:24 +0800 (CST) Received: from huawei.com (10.173.135.154) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Thu, 6 Jun 2024 14:36:24 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH v2 04/13] mm/memory-failure: save some page_folio() calls Date: Thu, 6 Jun 2024 14:32:38 +0800 Message-ID: <20240606063247.712575-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240606063247.712575-1-linmiaohe@huawei.com> References: <20240606063247.712575-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.135.154] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BE4A8A000D X-Rspam-User: X-Stat-Signature: xjwte4qewtupey7wq81un4oboxxcpyuy X-HE-Tag: 1717655788-491629 X-HE-Meta: U2FsdGVkX19zRrCsnDW5gGlUIAcxRFNF3jySLke1gbN/Lyv1np89OQk4xwzm8xZhRNEys2mTwCCtcyDyfSSLkqEjR56Qo0ITv7G19jeu5cOV0H4SUiSDsQtO5P6E2ZorV5H2SlMDe+Mxd1Bs6iEyLgBUDEJuuIL4JiVZzBXzo4y77HFWUmzVOQiKdqiTjCyuUVsaS/jjkEZAHdZwziujme1hFw5a7S9inw900TCYFFbv6KbEvmopNWTnQa17eYbZnmfPzxI9vCbDUxXvKyu/pQeM9QqPTG6BvNaUM1sHfm5Ury7AElTC0kumV7jIkVQ6lgiixA3jMCYG8DMzBYo4T4RBiqmRC1t973AA3P49pYKa2O4/l19tgs79paa4MaKHKx1ExcM7ariOv/KtvaRmNUP5BhNjb71YJpZX5IjDbv7uAll5bLfMKmFRsnKjvniny40ipZ/kXse9FElskztF7PI49/3qoXnEoPcUZ9Lp33iYEtS3FdVY1nxUwdl0ozbWGSop3VLk4FbJ1usG4mg1teoKkLGilumM+yh9fgMe0JDRDguf4DrFPpJ5/ZBJ58tQe/brukyD2y0AF4Gj/gVtjwh6n/HYrOsm+FHt922mmeq84aQRYZWlk5EnNHVz0ZrtgN1mBSW3Uv/vj0wb7BL64iyHfEcwijy2C7Twkl/C3Qmrh47Defxf/7T9ypgo68QMAXFcRspjdOM0NrBweYVqfCJ4j0lFw4h9GJeEBM4H55UiDnLztb8BWXrPTYDyxPjQaIuSo1Sf4UrzsYDXBGYLOqiq0i9EVA5w/8hcv6CcYm6dNRWHMXnxm4g1mCHV6q9WgSiHGlbUHni8yDJU8XdJj7rmitpj2slK3H7awrJD5MMpf3AWe6pyx0DAzg131Fudr/19IVOjzinjj8ohjWpC6Z1adXguRGYxzuwqJqmnsU1gl53pyNblDGasrNQH3v6mlDfHamf0nD6ayC8uITu z0ZiT1eF +Lj6Bf9hx2Kj9nUmdpvZcJs6XD0LOvATa6dgFNC9nRz8Db10XX5kdhvBVL7ATTcaQJA+gUSlH30Jw/NJbT8lyCVz8Qz6mBhn+ULF+HupojgTVvVIGuwFV7c1ka1/cLkgLfU59yisL20UZrOYMXiERaPiMAnVXXr0tVvmIB+TG83/QKXf/67XDm4Z/F/rC2xgFDrifkTRUphJYI9aJvmpZhd0TJeJWDLFJOh0pBe0ObhKV/tPuA8j+G/zQ0EZczYK0KuUf0VS/3VtCkULvBcFUrlBqm2s99uWMf9ei 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: List-Subscribe: List-Unsubscribe: Use local variable folio directly to save a page_folio() call. Also use folio_mapped() to save more page_folio() calls. No functional change intended. Signed-off-by: Miaohe Lin Reviewed-by: David Hildenbrand --- mm/memory-failure.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 958b17a4b0f5..470c570d779c 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1575,7 +1575,7 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p, * This check implies we don't kill processes if their pages * are in the swap cache early. Those are always late kills. */ - if (!page_mapped(p)) + if (!folio_mapped(folio)) return true; if (folio_test_swapcache(folio)) { @@ -1626,10 +1626,10 @@ static bool hwpoison_user_mappings(struct folio *folio, struct page *p, try_to_unmap(folio, ttu); } - unmap_success = !page_mapped(p); + unmap_success = !folio_mapped(folio); if (!unmap_success) pr_err("%#lx: failed to unmap page (folio mapcount=%d)\n", - pfn, folio_mapcount(page_folio(p))); + pfn, folio_mapcount(folio)); /* * try_to_unmap() might put mlocked page in lru cache, so call