From patchwork Thu Jul 20 13:01:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13320497 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 8F036EB64DD for ; Thu, 20 Jul 2023 13:03:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E61FC280106; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E125C28004C; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CDAC5280106; Thu, 20 Jul 2023 09:03:14 -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 B871F28004C for ; Thu, 20 Jul 2023 09:03:14 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4E09B401F4 for ; Thu, 20 Jul 2023 13:03:14 +0000 (UTC) X-FDA: 81032005908.23.75C0321 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 7B88F1C00D4 for ; Thu, 20 Jul 2023 13:02:26 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 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=1689858148; 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=ZiToJVy6IXCLdfNrEMRmMkKZFmbdR+n71Ox99bPoVHs=; b=uXzcopFQtdhGxX6VqfOjnv8i0+hX4qR1VJYganEvlX9Ekr9UnLEKgsuXVGKKq93Fm4NbNP TSLX4HweupjqvjkZGIJJQW1yN5iqoWyh0rh36Ro2TFVCV92V1+klExNtBpT3SgRlzsCBN6 8W+9frhD0aLJ2h1OHjUEn6eJvGFwlow= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf21.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689858148; a=rsa-sha256; cv=none; b=LYxtPGV5KmlXUxdwrcolfO3/vfkux8EnX/NAma/4rhGo+hU+RpaL8ELGcwYIrNgYM01nBd oXV5pw3osGAX3yd/NSi59hrIuF4VplSIsF1uldv71WgTLRONxHgay75f1zvlcZzUBR2uQF yyk7rTz2j0Te/R9i3gDy+nYBMH5VUY8= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS53LFGzNmWS; Thu, 20 Jul 2023 20:59:01 +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; Thu, 20 Jul 2023 21:02:21 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Thu, 20 Jul 2023 21:01:46 +0800 Message-ID: <20230720130147.4071649-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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-Rspamd-Queue-Id: 7B88F1C00D4 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: sma6icnhd3haqjw66wfyyp3b33f1axdd X-HE-Tag: 1689858146-928662 X-HE-Meta: U2FsdGVkX196ZH0teYmSCB35STjlFzi39e0zJ6KfwF7XCK/4+4K0YbYtwZ6fLHg0FP89S/Q1W3QXVhKOdatGyDKmXNb3WMue59CcbpBXyP3VSOvJmxVE8E8Qo3sa8w1U6RM0abbDQqdZhD3ir9Iovz92Nhda1Ydg61GDj5QmD9flKzSo2BC2vrVSIRhEXqoSWYjUdUC38hoQnbhjY0sQouOQoiY9jzyy/w0KcHlh2J+FMnh3GCz0c+jszbGV3aJrzGNQegOGTWYSU0BUwizFgcKSty4ntIKZNNBVHgltEt+quPOR7eq5CinDkP+mAo1WK/DO7KCn1i+K9bddi/0jzDVHHz2ymwv3VIuhLMiPdua4qctPmzxZBCOQw80t0YfdUgiMl2KL0xG0Aiga3jf/rH5azXQi5+4GeBzFdhm9wBRSnsCm+Aw1nuzxp0pOiAIZ8DBQN/qeeZ02w8f2Fhjrjn8f4Dk9oavKjUvoGlQzkqJIqKe/vOTreGLNqR+XqSR3KwrRRWHKM+sT2IdH3w6rtP8lhuy/TvGIMBzXSiJcrP5oF1AdBjaXBslIxPzhmtapjZL/Y2RAtD4k0AvL4OjOqhLnGfLBFwvEGQFkDoJ0NTcp3sZCnsVfIsj+yEXtf5xoFHV8l1a/uRRqjrMKIJa1uoMgSBahzGbDyiBcp9XbWyf6v0Ii6qagFU/6npiZiOJsJC5zJrXAjgo0zb//U1dFWLodrk97KUgTVo7aJFG8omsR4Z0+jtDGVVx1qdoJB/L0PmyU1dHUJorTagdBoYk9bxhiw4bNvw7sNl7gluVm2V0vvaUsKnLIfHrLrUB7K8GiCqMferNQZxwVuJFeAfmAWEOq+dILYnmfM3PN/D1j4W5k4DWQ90AQH1cUuOj7D52q0RXw3dprTj6+9G/ertHZAQY76GlxOSkCIUQKTtyiZdFD/Xyl40t0J58HuF7MVAkIPyEjoLaBDs9jkZAF2N7 HXIh3AtV Rbx7U1jgqG1kJ3sfndJjVoxsA/vkE3zd8KqZfG1BtnV0krEQHCLuBvwNXxizh+NMGfmgvp5P5BpLbWZl4ZL2ut8AyvHd65puR5QrAkNlkuRSmSigjUPnM9scyL6XwrUpxug7A8Eh9CLsAq2bXPqwP9kPVt2AKWgHhh3Ul5AHZvU6AlxK6a3VrF0PupvYvvFhMf6Bv 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 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 07bad3a4b701..da3f38404585 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,11 @@ 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 +278,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 +337,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 +360,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);