From patchwork Mon Jul 17 13:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315703 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 D21A2EB64DC for ; Mon, 17 Jul 2023 13:26:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DFFE6B0074; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5693F8D0002; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4157E6B0072; Mon, 17 Jul 2023 09:26:18 -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 285E56B0072 for ; Mon, 17 Jul 2023 09:26:18 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E7035802E4 for ; Mon, 17 Jul 2023 13:26:17 +0000 (UTC) X-FDA: 81021177594.28.39112A9 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf16.hostedemail.com (Postfix) with ESMTP id 99B2918001A for ; Mon, 17 Jul 2023 13:26:15 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689600376; a=rsa-sha256; cv=none; b=Qk7XnrD0b969s9nWEgz0gzW6UZ5a40E63/38o7Yvwt8yn5gyXHyZyiZ0TI/RSmV2FDh27J DoC/bBSrn9j5nACUQ9DlvzSfyqBNT85VHXmZW75sG5ENZ3Eov2JveP7AlZKZeJQ4+sLOdn qCOlNqUygGfuWKmJjYKYUq00Mpk8OGc= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; spf=pass (imf16.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@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=1689600376; 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=vJ+qedAJ3nl0orQtqLDDbaTMpVKcZimuaXBGhCdSkuU=; b=oZI51Qai9o6pWeys0aRT7BZzlwp1Jipz/8GNYsIkFg1GRr8T1+aHk5c9EAfTiKGoABzfox FF6ly/ErvacT5Ecfpr8dTwlkZpiHGilidkFKKEUNCIathQWXIvsYPkKGn2UGdyVf25Px6y aqkkmB2toHdo/Mzv3IQz36b5ypNvzXU= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R4NB24P85zrRlt; Mon, 17 Jul 2023 21:25:30 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 17 Jul 2023 21:26:11 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 5/6] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Mon, 17 Jul 2023 21:26:01 +0800 Message-ID: <20230717132602.2202147-6-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717132602.2202147-1-zhangpeng362@huawei.com> References: <20230717132602.2202147-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 99B2918001A X-Stat-Signature: 3rcsn3zsm1uyszt55f4jtgqw88363bpu X-HE-Tag: 1689600375-442299 X-HE-Meta: U2FsdGVkX1+6/l57RHX79j/FzqnlxUgzPraEpXXQuCDQKiac7awtVPV6vxh0DeHCPuBDgo9s4M3iD6TJa0qAUh6jJTZRroyBSSMFl/FCOiOCTYwdwuTqJaH4Mq5MoPedAAIdBRlGK+BJ6DLeDr4tkf27BqxpKwJVVgRrJLvbgT+S+vxGVGQra3kc6M666Wb5r9UVA+MkH8SYnos1/O+bsD8d6J2Hrv73oXfCUca7i9xGX28YqMocSw2sMYEUA6A/F6UkP+i3s7roY+2lDtoOFsvD+BPFVmrJnVXPJotH9tyyETxrQbnbOUFBQhqFlElk9ADIBA9YcZE5To7G84KRoaNtkM7pMlSiezWHerEH6TGjCekPPFcbFOQyaUZi+S68tazxq/dsViyyRc3r/qron1VZX+AjhRwU2OYpgN73GnOvqanpVTVZltHGmX43118j+8hfbcz+OTW5x80eUbESvWNRpF5Ea3kyeBqHGgWc9fOw/s13GF3SSI6apK/l3moS4b0Y18DckEwjW+IB087vupYT0FmZ9a8IqYmT/oDMa3xoueZ77p32E/G8MQfhULomYf2msUMOYX7JmIYlormcmnw/E4TembCaytiESsK+SYyB+sYsuciJhVzR7i6bspakWeehUIHWq40dKFKe+HX/wMbIf1BCpINKMrqkpHxFfeF9shDybuxgPjjrAw41IRSQTXUTEsh06xi0R41goCFN1cld6VV3OAJzalarIxfSxxTt8xet741yLkhHddK5+dBsS/9twrN+IiLN9szbPXYao2xwlK0Ew/EFHuawodWuhO7cv6FE1TNAoKWfhU9737tu8gpQMBkTvddB1y29o4Fc8mfV+XZyrJHrW8aiAVMTGQ7td6A87IWPtSobLAn7F1w0S45uYByqTpxRKnDH4RFCEXNOj1JuPLrqCD1l4Rm7SYbfJfFm2VkTmw3jDMV4+ksCW5SI5SEvZowLYclfw1l UXopmS4s JXzVCJWOSZqmrD4nNV1ZbGsJYo7tRkpT9WgIANXuyljbYGeMwqvVab9ng3vpeISSt2yvbI2mdXHAuFi6hnTeNszF64w1LpcAleRn/mYYAW5G4IYGrzwdgPJB1yatOr08OCJYThtvN1WqZCdaW1xCQ+jghBygeGiiz7kQ07rfRer/mJvVnSQFWQM1nrAl/bXEeGha7 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: From: ZhangPeng Convert count_swpout_vm_event() to take in a folio. We can remove five implicit calls to compound_head() by taking in a folio. Signed-off-by: ZhangPeng --- mm/page_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 84cc9e652451..66e8403bf96e 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -208,13 +208,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) return 0; } -static inline void count_swpout_vm_event(struct page *page) +static inline void count_swpout_vm_event(struct folio *folio) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - if (unlikely(PageTransHuge(page))) + if (unlikely(folio_test_large(folio))) count_vm_event(THP_SWPOUT); #endif - count_vm_events(PSWPOUT, thp_nr_pages(page)); + count_vm_events(PSWPOUT, folio_nr_pages(folio)); } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) @@ -283,7 +283,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret) } } else { for (p = 0; p < sio->pages; p++) - count_swpout_vm_event(sio->bvec[p].bv_page); + count_swpout_vm_event(page_folio(sio->bvec[p].bv_page)); } for (p = 0; p < sio->pages; p++) @@ -342,7 +342,7 @@ static void swap_writepage_bdev_sync(struct page *page, __bio_add_page(&bio, page, thp_size(page), 0); bio_associate_blkg_from_page(&bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); @@ -365,7 +365,7 @@ static void swap_writepage_bdev_async(struct page *page, __bio_add_page(bio, page, thp_size(page), 0); bio_associate_blkg_from_page(bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); submit_bio(bio);