From patchwork Wed Jun 12 07:18:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 13694534 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 BEC1CC27C77 for ; Wed, 12 Jun 2024 07:22:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DF686B016A; Wed, 12 Jun 2024 03:22:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ECDC06B016C; Wed, 12 Jun 2024 03:22:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A230B6B016A; Wed, 12 Jun 2024 03:22:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 5F55B6B0167 for ; Wed, 12 Jun 2024 03:22:27 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0B9DB1C0C37 for ; Wed, 12 Jun 2024 07:22:27 +0000 (UTC) X-FDA: 82221393534.13.796AA7E Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf13.hostedemail.com (Postfix) with ESMTP id ABF0B20002 for ; Wed, 12 Jun 2024 07:22:24 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 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=1718176945; 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=5721A9vZqABTh8oEdx+PDIZNm3Mo7a0sOlyNrjiBrrOtfbUD8fszGG+o9OwOnWUvlkB2u4 2aXX1PQuCCbEGWXc59jMYh0iLPc7vLBc+OE+WmNOgHhYx1/zH+esqqpyzwgOko70vj/Yqo qiqltXpKlfFjafn2NHuNDfQ+TiModJ4= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718176945; a=rsa-sha256; cv=none; b=uHTptEoyYhg6PYug4zzy1or63i/1+FP3GfpXjyxgRByWg3Afi15H0dvjfRVQdhOXWbwzWE L6auYlGUnJptFNFiRyK099JFD48L86/nD19a1DBF2xEfovnA9j6+X+J+l+tUqiSJoRPOOz 4ZH/mt3Jb7Gz63FolXGzTlOiVP0ojlE= Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VzcMY0rTgzxT29; Wed, 12 Jun 2024 15:18:17 +0800 (CST) Received: from canpemm500002.china.huawei.com (unknown [7.192.104.244]) by mail.maildlp.com (Postfix) with ESMTPS id 64D9D140154; Wed, 12 Jun 2024 15:22:21 +0800 (CST) Received: from huawei.com (10.173.127.72) 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; Wed, 12 Jun 2024 15:22:20 +0800 From: Miaohe Lin To: , , CC: , , , , Subject: [PATCH v3 04/13] mm/memory-failure: save some page_folio() calls Date: Wed, 12 Jun 2024 15:18:26 +0800 Message-ID: <20240612071835.157004-5-linmiaohe@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20240612071835.157004-1-linmiaohe@huawei.com> References: <20240612071835.157004-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.173.127.72] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-Rspamd-Queue-Id: ABF0B20002 X-Stat-Signature: oppaeeuz4i8zna7pn6cmntws9xoab17d X-Rspam-User: X-Rspamd-Server: rspam11 X-HE-Tag: 1718176944-214227 X-HE-Meta: U2FsdGVkX18uwsUP4B2PruL5bmOiK1w9mQKt0k+ZJrZ5yZrgCKINCIj6+WAf+iVftEIgKQNxvj2cqZ6IMgmdQIrL5qQ5N0i8omOWHHqaaet1wvajZgXVIXfeYVM+3svozoE3fZW+wtBjTFHDcUHoUsoER3UgFOvqkCX1JZPp1Nz7zbJXx9i7NZVngBgQxVR60De84kQbC0z023W1W/ETNFREt/uK7qoeWJMtbQy7mXO122bJ9yvAujIcg1/vOYSAWsMDfZBdxdbFRKWUGpU0bf08zOkBShvdXSj+xr7x3zjO04StPTb3S/bQ+UgtBIP36lanjp2z20atMhhwdft4ss6kOPrEAQwOMxj6/2F3yb6AY/TJwDt6Vs8TdVNPiYdRRN8r+0//JAxBwJWBoGa4mzTivHmglMG4T8LjSgfMvthjjmVpoZXOCMgWVRWkxRq90fiUaAXLP0SPerOphgoeJYKYoMy+Q+XsavJxDExtMANaYcA7wh4uVLrYe6mhuk1PZND6y0NElAmB8CMD9wkLyDnMf9OzPZQuT1WkHoim5zWl0CfLq8UK/Priy5kApdfesvMBRMHWBG6s6BRPPJXCbgTpSsZmzlPM6zSbCiUtV3R5V9qbRt0uDi08A+sVgFwwwaX8fHGOL2tSVeVY02tDSzh0c3cdHvETTipNaYFevcnCuVwPioClKtt3EgpD0AchoAN+yR2bD2CbAXVow0VdTYrJDiIUvdc+epTFDPzjfz12OYC9kgIlORThwpmYORKwg/I6+cGDM0omFOf9yPb3wziVQ67Xrzo1W6jiL6noqp3ebIhjUuxwpNL26tFwWxCyxfu6+iKSS3iJCOpyk2bBtqFffgTXN6hh6olMS7qwwFVhIF9Uxu2zzjIfcCBm0omkPo4N9ARoPKRMB70ppn8KjWelR3M8mJzjywrqW+sQotTvVD04aL4RM1axkGDROd+vyFDcyvJcl9edVqrxr3l eSjf66ga Onah0lqXbycJQ4c8MVMu4ub4gMJswPhlBbLx/1J2JdjQYLxDc7q3nBjt+ZDDhScS5DC8Dxkvnj/DsVuSXNSfdf2n25s4dIwrCQnN2O/VEHTCC6Dl/CImjOeVsNURAPr3hmiaegYQSKJxbyevbaqrmWWqOTXxrPecR98b3ZA/tcwBGo1M+0IkX6Ej79qejDGLQZ7sDOj2KBzz9ousgCl9LX6oki6XdOgjlOwIrFiX7uujzjYJV2voHAcLXwmskRwmEM4dLSBgHje789GGcGcl/XIOB/u6K3tX1zE4b 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