From patchwork Fri Jul 21 03:44:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321300 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 767D1C001DE for ; Fri, 21 Jul 2023 03:45:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BDED28018D; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E772B280190; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC93B28018D; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id ACC8C280190 for ; Thu, 20 Jul 2023 23:45:20 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 7B75EA011F for ; Fri, 21 Jul 2023 03:45:20 +0000 (UTC) X-FDA: 81034228800.12.9C3C050 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf26.hostedemail.com (Postfix) with ESMTP id 35A7A140008 for ; Fri, 21 Jul 2023 03:45:17 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 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=1689911118; 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=2/8lQu2NaqApJJJ+XOK2DzlbE6EAGV4Nr6XhHRmOd70=; b=WhxZAaqKalm8Da3RH1OIrBI1KSdnl88GdEclv7g3aUIkZle8NKXdlR+9zs3VbkLHk7YZvI YxxuxzWbJ1yPZXxxU4zVhtyBTPuPXo9BTDack3ad0utxqwX1P71Wbj3MZvVq2EUnV2N/EU 0p38OcyVZk0Iv2OfmW6v3ypjpPvYxjw= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=zhangpeng362@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689911118; a=rsa-sha256; cv=none; b=mGiIJ3r6dgLwqX8Es/L25O2wLvhIbvgfy2TALg2BRm98zylLvJL1Fk5/7IqJyuxInFfTng 3GqLbAkDHI2EhpDrwB4WL1dw5ch1D9TbMSMpH5IOhpIBrWkk2PRF1IXpJOjE0kRxYSd+vX rPBetMRw1cMwWcaXIIaJmi2P1LJIiCk= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m5fdHz18MC6; Fri, 21 Jul 2023 11:44:28 +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; Fri, 21 Jul 2023 11:45:14 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v4 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Fri, 21 Jul 2023 11:44:50 +0800 Message-ID: <20230721034451.16412-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230721034451.16412-1-zhangpeng362@huawei.com> References: <20230721034451.16412-1-zhangpeng362@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemm600020.china.huawei.com (7.193.23.147) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 35A7A140008 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: s7b91fwn78pacumukc4io6jzc43m7x6z X-HE-Tag: 1689911117-965586 X-HE-Meta: U2FsdGVkX19pA1oATL4TOeE6Clh4bd16R/hmPqBAzIqeiBcFoVathIC6ORsaPlF28Oa5m9erK5/V0Yue8DTXVwEI34lPOnJAkM4+y0Ud6lzkyx6LiBunOcYi6JbdvhfhfX0fg1wXPTfvxlyzibBoFI0ObvPoHPUXHbgKoakaVbqXuY0rZPObYf3yGHKiXMg3QUFael/7kHTEP2vD4WMqWbeYNEiJfhxQg4XtNZgwj1DABhrD0B9mQ565ftqV7sgK3gSDstBmA7pgXV2+99FxOQ8w8VBxkKBIpiYqWwZwrNzbg42SYMJMYiv/qFkYTcRIW2qRaI8Ge6NlBTnAYhUdYEj32+lK0/ZbgXt899DvxMzS1wucgJXmaVwCcmDu06y44X1ZsYO+TayvFA9KjWp4EakgOa2MaD5x/MXaq6wxYhFKfEeizle0QWZi+N0sN6y34NdUS0at57MWURxshm3rN6nOT8FE5iWp6YnaIxKIRoNSY3VuZTglPWRAtFE2SpVBjTSUMJEBIxiSm75QFSHVrQudt6SFTzCsK1K5ZXbZPgGoZfkK15ERdfTkJe6sYlQuzKLQr0ixlOu3mWMKFYJeQ1wlVQ38WPgramjzYO5GK7mcq6Win7LgHoMGoTHpdaZa+61X5qzxVd4Guc6eqFT6dWLRK6aqMgV9NARdkrj1MGkuaI/EB0/VV21cd5mtkvg+sCbCUkpxzK7QwiDlaHLHi+EGYx4ISV82VGAbh654cLigPehq8bVTp8AtmBER1bAVbV/t+zXju4t2YHd7eNIMo9luT7n7dknuP5JHyLhXtMXaeN77e9umXy0Xm8EmiQDCFPsbEaM3vfJm9b+WqTBO3LeWa6gFElvQJ57nJtgyUwHieTj1KkCeYuxfHOOTmJzkwY+npoKK8UfLfes+Ekpz/oEej1CtKNbHI2HVl2ff2NAFPpgv/cFBsDLVxZFjl8i/EmTQPp1Q4cHJXaApYIz sI+56PUS TvLLZby/pOImh41VIPKeuCysVJ9FcQYuIaoh5ZpdTuKvQmin63yIj0aczH/9OXwgUvrEkwv4Ysunz+5ZWCUH3LItZT8GQU2G1GndcmjsQ8wL+4ouBG3jqewSrYnj45jh637F67Fi4AckzBWPknsKG+02GmrmI/ddbas0zaBYAtcrQOAa9IV4zc1hC7ePuMb8nJZGP 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 07bad3a4b701..f575c0bf545e 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);