From patchwork Wed Jul 19 09:58:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318704 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 7C9F9EB64DA for ; Wed, 19 Jul 2023 09:59:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E42F280049; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 79568280045; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E7F7280049; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4E683280045 for ; Wed, 19 Jul 2023 05:59:05 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 292E7C01A2 for ; Wed, 19 Jul 2023 09:59:05 +0000 (UTC) X-FDA: 81027913050.24.A28A310 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf09.hostedemail.com (Postfix) with ESMTP id 02179140009 for ; Wed, 19 Jul 2023 09:59:02 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689760743; 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=h0zgsx3kKMFpGJVNCTy73NxTaUsiGD9mJb5htLkWjOM=; b=wnUlkGNR2LbZABh8sNwCEAHcxWC5wcTwGC/obh9MOArfpdu891YXSDC29xGXj/KZJt/o5B hCWfwVP7PIW5wfVfXK5yONnBirPyFmlWpOpM4RyAzytGqKq0McLCrt5wZuoxlrhVBLjNPV 9twBPcWUV0bsSQpQMqFnN7ULSBd3pZ0= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf09.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689760743; a=rsa-sha256; cv=none; b=oaWAjVoHZwnv4gJOinAytFwFfjkcK3dj157ZagVzd3r/NuhS1UgjImyF9WGKHrk3jYpCyE oZQ63QP9xM7Ack6s4OOHhtmzUr7Ydhy/c0gwqLC4/4KPdDISm2zi7KBiZO6MrJv+Pzw+UP I/SXy+mK/Dke3H2A+PtHUTcX9/HelpE= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R5WRF2wptztRbR; Wed, 19 Jul 2023 17:55:53 +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; Wed, 19 Jul 2023 17:58:59 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 8/9] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Wed, 19 Jul 2023 17:58:47 +0800 Message-ID: <20230719095848.3422629-9-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspam-User: X-Stat-Signature: uwnwew17kmmif3mr9bhm7jzcys83sb1g X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 02179140009 X-HE-Tag: 1689760742-422959 X-HE-Meta: U2FsdGVkX19Qe6tvnAetdnNrQZmZNIJoxaC5GpVF8VGYSOxaYA/3gFSf5MyBMLLnqZQkuF+gWm1M6ViM2Y8ZVvAgnXuaLaW3KDRm6325xbi5h1bTJedri3Qk0E6OC35Cgdc8GACfMduZ+gJ43O9oAsnPa4lPbb+S+0IwamehAPbJ5lnMJFSBTS8bvmSqPzQF3uMRJzP0Jy3pwnIdWgn/YnP+4MVtmmElGURERscekdTGZ413OHa2JuIUoPiK82I/BYiNSUVMat3RSgJ0L7JPqC1+qoANr+u0trVxyVJ9SOvtp95EC9CwFN5Jj60LB1+rti1IVp5tHDOXYL0+fGbKgWOBig6bIfPkhlIuqSBSOHwbKZS/QGnJgyLTfpNOflHAnLTQz1E3cicN+/ghFhjssjHH33uoGoQtmi2BZw/B+d5tVnvLMoGHBo2ENYAfIVjy28HVAZj0DCGdSrnDdSJNT0D6cEoc5My6TMgsQfrnZpUdvOS0PvDFUcxCF2gvYJ6omVh7OyYh3UJsx0W/rp/dFpcYVqwyQ8fE9XPFgQUDEDPEVWgmf4T3tTYK9/NjoUiFLTr9lOZlEJkWGS3Lyy4yCtGWlud2xr7wa9vBHHJfgKjb9hvJcSIXtZtjYzBOlpi1izWRBZufRUKQj1Ikk/3Q7atFydsv0qwW49jc7UxkwUDO10jIqwsnTCd/ZRdU1dPvzA513cTj71mIBHvOwm0LqnzaBXqUS+tIsL34Zxf1xeMFAz5jNWOo/RHipRxN9qNn198oBAnXhILHPwi7JMOxLjnWTU/9Ytw82nXNipBpQA4B4zIC/xrShdsYe8HulAVZPX9ZeO6HcksBy2TviqwyfboE6U8pCJSIr1RBDxsXfwFGizIzyLVjhZh1Watjocyun7S397IeIO464fo+/u1r3nJ0QpMdvUy+h613tn+uBoArnoIaUtSyxig/gO1w8UZ9BpjqEMPhLUT5mf+EwKs QcPexjw7 dNrJwBhNigf7Flc1sYlB/UVFQzAsggPMwEESddJA5wUsgOhtJgXHlCsUN7AIPHC0rTNcWBzghCF5SLCJ7WxqBH2NIslBP1eWdGPSGcW5/Ge4lGQevAnMcpWnYziTEEbdSyC6YnWSJ+sivPz2mc6jgeLYEgD5aqZeeW08GFJ6p1fRelPlopvOE2te8Agq0UrCtiv34 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 e28395331bb0..fa8caf1c05d8 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,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_pmd_mappable(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) @@ -280,7 +280,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++) @@ -339,7 +339,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); @@ -362,7 +362,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);