From patchwork Fri Jul 21 03:44:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13321301 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 5EC90C00528 for ; Fri, 21 Jul 2023 03:45:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4299280191; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7C27280190; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B1E62280191; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A13DD280190 for ; Thu, 20 Jul 2023 23:45:21 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 701E8A0132 for ; Fri, 21 Jul 2023 03:45:21 +0000 (UTC) X-FDA: 81034228842.13.B41CEBA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf14.hostedemail.com (Postfix) with ESMTP id 3DAD5100009 for ; Fri, 21 Jul 2023 03:45:18 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.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=1689911119; 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=KNlRzNfWfPR64nJJeZxoqIl1zjDq2dYg52TSFoUVVk4=; b=0UC17pHQ79IlW9L96qEnsfKnjrCPRgm9oMTGwqtyFtAIUWBc+pHetiCqt0pEktCeGFqQXU pmTuCuncV4NTWktq3XU/4SL7trL9QRLnQionKXkANtFhPgEFIeWlKNGHyviIHeuVN62kuD 6omG8VCBtf05frHmhtCAfkL84VNLMSY= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf14.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=1689911119; a=rsa-sha256; cv=none; b=pz/hmlYu51IePEn5CFb9edA6Oy2BYFiNQxfEevuIOoQ6B+l28q2avsay29rEZcHgpJ9rAA DHOEyk0T1OPL9L1VPISRq/GP0t9uktyqg02rJLZv/9q6T4S8ffAGALg0xHa19lTgaw+m/t 891/48dqhcbc5c+UWmiSDb+jIHNmNWc= Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m5KpQzrRqj; 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 10/10] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Fri, 21 Jul 2023 11:44:51 +0800 Message-ID: <20230721034451.16412-11-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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 3DAD5100009 X-Stat-Signature: xety5zc5tr5gnj4s7738hck5q63nf18r X-HE-Tag: 1689911118-871029 X-HE-Meta: U2FsdGVkX1+OqQYeJ1Z1GSW8CTlfghdmTeIk59Nt+DL2DMoIl/8H/3GEufCxcjv6Z74OiVpZjqnibNgcBOVagDfxWcG//rc82aR+V4sCsZmEVaiytZ8eG21in3U0mxOOd13jR1oUufUsxkdZ+uM6v1X4kmzGHHeNuyLTTztVXlh9TcZeltjXN23c87+/Ovc6MnHqqaI8hU4ylwKK2zZOU2OEidq9WtpqcsYv7WSweajs3r+JA0jUHbpG54hVXYULr4Fq5J9iiv0OTfca47+oGdUa9UbzYx+VBaEXPvHRHFH4nBmY84mdJBtC0lk0/CzxDn42eGECpTrz+uMykLjzNuabJiuo5ZB5oVCvuZ/yW03qsRWPipgovsIwrKKtrg4OznQI43qtihfE3F98qdZC17QKnmHYhgXxsfK2v15JEL9Qi63RIdsIV55/cg48J3JyVp6cZPBcROW7QzM/cH80KFHD5mgigYtZEBf9dXO5PEU6AsJhhFMEbbQKQVPmSX6l+TGi8LSTQgBS7yS5pD9C284p/RQRSmCIwjp+hneCwTk+mJoAzXyl9xDp6k5PtWelT1VQGIeV9owEf1SIO3b9cZKWMvO1aUjeYlywmf6oyJPe+keaoAZtsn570nn6MmeVLlQz+AI0EMRbd5yogs6ww5TbxlDKaZ7etHY6g0KUBLi1z1e5OHRXbziLxYM2YjxuDcdzNu4vHXeYSqO+osMvZK2J/sRYlNxWz6UTpfFp0I4h7thrv5O1SR9/D/Vy+3zZH57cctQLjM2uCZypaE8tNuuPpV3oG6izayIntoWutf47Jeb9Xq58AYNPjdIeuYLFABbJ1uSp1asZDCxAiy2AeFrwPUm/2aEk2ZSmFWmWGyU+GoOhcGs2uRENUybiFCMCEyMK3drY4jmdX0RtHvEhY/uDl6XiBEXpnlZj1ocOOHA4oxLne8K18vleQCbKU38fJUfPc995UxZwcTLnkwp qeAxXg3R SDLB+3bpmXA3QrEjb7XupUro6tTIQCK4jXTrCpKi/HbL0tb5pBXU8Ltg8veXX1qMavSBkBCSYelOjX2C93n156QILIiDUtJLjawyWgxoqO+TcNuZK9Ct3cNeZ4E7xwoG14fHkf/+TGk9J7dvfM3AND2Zy/eTLIrtBVxBufg2z2oVGtD/ZdWdnMI7CUz3q8CnAKeYOQS1aaxdQg74RdlbXcxwTF3BQv/KsqKN0aVQ6toLcxq3tx0CHiPO4cg== 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 f575c0bf545e..fe4c21af23f2 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -215,12 +215,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; @@ -230,7 +230,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 { @@ -338,7 +338,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); @@ -361,7 +361,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);