From patchwork Thu Jul 20 13:01: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: 13320499 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 D297CEB64DA for ; Thu, 20 Jul 2023 13:04:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67331280108; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6223628004C; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4EB39280108; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 3E97728004C for ; Thu, 20 Jul 2023 09:04:02 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 1CBCD140218 for ; Thu, 20 Jul 2023 13:04:02 +0000 (UTC) X-FDA: 81032007924.04.A99D69C Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf03.hostedemail.com (Postfix) with ESMTP id 8D619201FA for ; Thu, 20 Jul 2023 13:02:26 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=none; spf=pass (imf03.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=1689858148; a=rsa-sha256; cv=none; b=uYD4PZ8Agzk+g1BNjGdJp/LS/Sc9cKVFtwZvzP7VJhxvFh8nufVW1HVA5l62GfVIPQIitY pug+IZRIfYc4ZOqPuYqHhccI1d7SFR/iaR+Kw8SgL5qzujG1hz9FEBk7Jtuaf+0LVnZdyS THS4GAPHYSvqGHCIhnXt3E5nJwHCido= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=none; spf=pass (imf03.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=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=4t8XLJPyanjJPYKfxZvv1GZ4bOrqT8Oez47EILxWmoc=; b=7/uIsPMIT1w+/Gk0svHaV7/kUGDSUqFDB5YgFXtyk4gDeeEvzbrSqJGZblD3f1S2qilq7e 0DLGwRAL9ApCLhDHWp+gC6ngTbD6wlzfYwTKv/Vd4zZoUqSIqEA9c2K8EKg2WgUjJ6EtY+ /xwrqcqGzpsQ98VQoCxzPYvkO6D8kXQ= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6CW44vcBzrRqs; Thu, 20 Jul 2023 21:01:36 +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 10/10] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Thu, 20 Jul 2023 21:01:47 +0800 Message-ID: <20230720130147.4071649-11-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-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 8D619201FA X-Stat-Signature: hnxfutm9fuifayb7j7cyagubxjsi3h63 X-HE-Tag: 1689858146-341598 X-HE-Meta: U2FsdGVkX18plKxmovGvlACRMrm3GJ8iOc2mw5Cui39Hmzm/+rojvTZ6wNlNZ6HvJILfz5hbSi89W1xxRoo+5O9+ofXQwFvj2rR/99TYVjMO3MWZu+jvCizPlHairH4NX+C64KTLZYqmZhh8g9yu3xHJILPnJA4m7wvFmU5KMi9gKl+sBexyMUyBKQ7HKGnMwTf8Z8M/6vHK9B66HUzk8fiL+6ovppqXbDRqDQlfpibjQ24GnRzm0g5Foby+1Lc4GneOXneOy16ti5fR1c9mTZAm/77OD0S+nw35+2/XC50XtaYYD+G6r22Q79d1i+Z8IDNRhK2K/fjDrCCm04WFdb6Xy6/k8yjQ+VR/xyCjpNjPcjVnPtVjoN2hOLb52s3eudi+rjNKM9P1iAb0JQpzutdTJecbmMipIOz5hJ+kRjK1YoKiQktBwauM2tTLkx1J1GWp+pQI7sCpbS8iHYuXnMlHQP1tpwcf9CWhirdTlNe+zU+7yoDxw1a+tGgBTKKDxogVsNtPuxWIVB7NtSefKvvXO24kWGZv9LPi44flnA45yG8Z3lM1Tdg94s0Fbt1xc/pmZDK5GT3xg4w+okSWD22nIwx/rpeGZIk8BUiQqWKFaX0IzE9JUuh9cdeMHanOD5k0J4fDQedOKQOiFNhoiUSh1lmDPIk8weU5+/9GHkmBDSRhWpZc5Rkk/0GTJrVdXAJJTqDSTFAjM10iTDsRCCC9crBY7fRpOgpugXWepgeFYaRoUPhGdlfs9TNLhZFvT830N8vzsXq/f4a7OHW2RiMJaBQjMUyKkylyAP1eNodccj/syXuvYE7Q6jn0m+55Fz7tFCRpvheG7Ovp05KfaoURGmvKq1xlXec3yg0Ce1R1fJ++2SyqBm5gB8VJapj463Xq1kYMe59/tl1d7GnY4LzlxNvpGIkxGwW6ZoBzqlK7a3EW69mdkecaae8I2+BZ4KwltiKyH8KiJTjqF1V 9SWLaFJb w08rLu2cY+a2TcsXrm9puG1rT9y2ugrPDN7JNkTZb/gos/rqNANUjkLfqCzUZzJua90xwm7dPRs0sZOTkTZKyZETggPKCRWVoUwqaYM3DuoVSlEuW/0UUX3WE1jr9w7CGZItj5j8coFpnRk0Lc1CVVmNM0MXZbEn2flA48XCjNGbxuc9iqlgjH+LqCIHJlMyzpdsKVktY0YDJIXkmbf8CgcQH66/Or0Nef+DKweume5evaJucWSqD6z0EMQ== 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 da3f38404585..cc2503bd511a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -213,12 +213,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; @@ -228,7 +228,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 { @@ -336,7 +336,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); @@ -359,7 +359,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);