From patchwork Mon Jul 17 13:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13315709 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 59A4DC0015E for ; Mon, 17 Jul 2023 13:26:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4F5E98D0007; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 47E768D0005; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 283B98D0007; Mon, 17 Jul 2023 09:26:22 -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 062038D0005 for ; Mon, 17 Jul 2023 09:26:22 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BAF661C874B for ; Mon, 17 Jul 2023 13:26:21 +0000 (UTC) X-FDA: 81021177762.23.7BD4471 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf18.hostedemail.com (Postfix) with ESMTP id 2318A1C0017 for ; Mon, 17 Jul 2023 13:26:17 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.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=1689600379; 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=4sSpnbOCGI0f8tYl5oWsmEUitL7U2pCM9ujFaXA0EZk=; b=AD3fltVnLDbsykr5ea4sGJoKkk9KzvowKIwDFhSwWaIcsecP0dFkzJDs8K6VBQBFXH3/IH 9Yp2xkoLt45hcN+v97p+J4JyrxaYjQR/KN9Ow70YiSHObH70QXc389UPugysv6srIMri4+ bZlnFf4xppHAspsPr4W+Zlvb4CeJDdA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf18.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=1689600379; a=rsa-sha256; cv=none; b=UVL9f3fsRbmNaYDM683I8qjqV1dG95vh3Y+4UHQf613OhIWQrSmO5I87LGMEuePdeqwD5G ekQaBnhteppP4CyXhdpzsAQbNsu1ITDv0s6CgLbxT38PNnr6hkIVA1XQyWHDY33vHfK6bB 6lNR88RkWyYmT0Ul/evUlRneO1zX+zE= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R4NB406HGz18Lnb; Mon, 17 Jul 2023 21:25:31 +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:12 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 6/6] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Mon, 17 Jul 2023 21:26:02 +0800 Message-ID: <20230717132602.2202147-7-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-Stat-Signature: czwp15ybomqsmmihbeeb9p7yjhdix7er X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2318A1C0017 X-HE-Tag: 1689600377-665125 X-HE-Meta: U2FsdGVkX19lQL1W2ieQ7IpKZgHMK13jvq3xOa22Mkw9Hq8fzs8q9m3bzRrVvbAx/Bk2xMLmduAbhOIcufQZ1yoOJKz4BtaBV/84dYrb2jbvIBgOeSLys/M/ctZm2NI/ZqfajEMThsLcqbTb5oFE2OsP4PG3CzI9YOXIp+hv/Nd7B2FyQHzccYPEktC/PG45Gsoou+Y8o9JwLEkozT+TYo47xSB9x6x77xCugprvCeE94WbhRxR4YVZ3BhBRCEpc0VsJdHEae9463ErwFmAw+bjHjjBFkbfgc94yUnxPg8EU9H0hkZp7vSq7ExzPziiWl63/kDiPqhP0QCFAe3t7fwYEQjupnhX+cdhj9mxvhLaE1lPVcDRG3CQqCpP/1OE3wqUNTFbVrSVKn0Zo2voqHvP1KLp9oaRmSNCvmKykohENe+SlrPxe5CMxHbd/yBZvA2tgD1DFDHvx39N9V8P/tyn+4zlQeY+PoA7UQmFiycJPbzU4mdEsQeL/8WmG+tHe/nVtE7p+Jd1iAMMdTz6Y7UDCqq8T16JLDEYh2buleP4nxqPhyvbfxW32bJGKUdQi//aAifk0fDBk771Zl9ZcUKkQDvYzishoIUxa8I2YXLJ8UKF8b+haE8QZZLc2hz1H7RMgzvOoip6ELO/mzk7tJ7a9L4KO9qs0e+2EVTq2ZZNLkr6Z7U66uMTRK1Eu9NxV5Ut9rWBduF4lQdIgctZaw++eDN0Lw+CB/xRuaXU0Sz2Wa5M/5O9XhkwA+TY9s01UBDP4OCcClmcMtR23N/klgAbV2/aqVQpRHyEqohPsDNYRZYkZSBzLYKdwd16FFgsx3NzeTMPuNh+2ZZzsWAqKu/KArp7T62wrwDDOdqUpDQEk9zvqIVqpHo83kKazoiN6bUXY/n1NfknDkOOuw4+p9mHjLt4VwAUipx3hLtE+grlBODRD6y23sO6v5k30oE8qPI9AYURgeHYm8IsxrAv EBxLakfM sv0cRF3YN+1re9amxrTmi+A+ILFqv06TfqkvbclA2y6JQfeWeJw0G/xaeaITU8N90FJ4MijWFBUhTNCFl9Fp93Y+AEIF53o2k1Ei1AWjW10g7bD4D8SaEqNM6NSgI7zPUlEoyGZ+b7jNW20f18BFQjRJrxZZ+s39Uy7jaNqaVSnHiekhWA6PcKEOQiKDlrIr0/+zC 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 bio_associate_blkg_from_page() to take in a folio. We can remove two implicit calls to compound_head() by taking in a folio. Signed-off-by: ZhangPeng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_io.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 66e8403bf96e..3c1fede46bd9 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -218,12 +218,12 @@ static inline void count_swpout_vm_event(struct folio *folio) } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) -static void bio_associate_blkg_from_page(struct bio *bio, struct page *page) +static void bio_associate_blkg_from_page(struct bio *bio, struct folio *folio) { struct cgroup_subsys_state *css; struct mem_cgroup *memcg; - memcg = page_memcg(page); + memcg = folio_memcg(folio); if (!memcg) return; @@ -233,7 +233,7 @@ static void bio_associate_blkg_from_page(struct bio *bio, struct page *page) rcu_read_unlock(); } #else -#define bio_associate_blkg_from_page(bio, page) do { } while (0) +#define bio_associate_blkg_from_page(bio, folio) do { } while (0) #endif /* CONFIG_MEMCG && CONFIG_BLK_CGROUP */ struct swap_iocb { @@ -341,7 +341,7 @@ static void swap_writepage_bdev_sync(struct page *page, bio.bi_iter.bi_sector = swap_page_sector(page); __bio_add_page(&bio, page, thp_size(page), 0); - bio_associate_blkg_from_page(&bio, page); + bio_associate_blkg_from_page(&bio, folio); count_swpout_vm_event(folio); folio_start_writeback(folio); @@ -364,7 +364,7 @@ static void swap_writepage_bdev_async(struct page *page, bio->bi_end_io = end_swap_bio_write; __bio_add_page(bio, page, thp_size(page), 0); - bio_associate_blkg_from_page(bio, page); + bio_associate_blkg_from_page(bio, folio); count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio);