Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7958662rwp; Wed, 19 Jul 2023 03:06:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHUjg6d64gx2hkgv0VRoQIN6EWNgSGcnYRTtGZRuhX+iighinH9VE3MZHVYX0u2ceWE+LBt X-Received: by 2002:a17:90a:d48b:b0:263:fc27:662c with SMTP id s11-20020a17090ad48b00b00263fc27662cmr15113611pju.39.1689761180608; Wed, 19 Jul 2023 03:06:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689761180; cv=none; d=google.com; s=arc-20160816; b=rC/Mx7q1uM7BNnyRl4kz3yowDs+ly4DP2//gcWvh87pvMSDzm3FttLhr4TXVB3y+/C fqpRib6M0JjuYgIbjiDMlaWBLAUs2p/0wSmlmCSWUBEAJ4dIycMyyOjRH0d6VlPy0ABW BO7qgypNEdgm32BOlxRsX3BzZiGmdhdBiZJSHpI3WQKEjzhxt+hpEvGHdHIoddDMHdiE sDeIpOyYfZvYISeYJEM24igHy5XQUwiiNzR5tzuus0ILfDOqPSnyiDj1veOPFJSqYRU3 Q7UQIEpTNko9QpyP3i8FsZazJ6epyVgpMIb9IjQScM4Zd2b7ZJ7frzGmy6DsRyjIjm6q 5btQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=UNTnENqbVIYj1TRfK8rpAxUpKqIh0BpIcBiqRUvXjmo=; fh=fQ8bSAglEIUMWaW8g2fbwjC8kqQICqHTc4sMCYJe224=; b=0YDI8zPXEWzEdKRtENLquVnwD7P2bIQLMfs1G/GmugRKKJoihGEU5/NO8Aaxn83T1M sf1+zYLB1ESK8O6V8TdBJj5uSRMkmuo8USJgkNzX6QuBbWHVBf/ChlMLx4t5S7C1dcLZ 4SU6whOoJI4GyxTH4eldEd2Boop6RXtv73C2sva2+Xe4hzDj0ybCVGeoHyfs74wED9LO WhSV4tF3SXyyjAK3aio181NGK/7RUVN+BKlfRl3n2wc7eDbuk9RFJZnKH2D9U3XUvNXg Immr3ASTjheqG2M7pGEFQcIr0/9E3453Sy2Il2S3VsHFjiJTD42751763AOOc4V400Q8 6IAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oc6-20020a17090b1c0600b00263eb5054f2si1186096pjb.105.2023.07.19.03.06.08; Wed, 19 Jul 2023 03:06:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231138AbjGSJ7n (ORCPT + 99 others); Wed, 19 Jul 2023 05:59:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjGSJ7D (ORCPT ); Wed, 19 Jul 2023 05:59:03 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C6671FC0 for ; Wed, 19 Jul 2023 02:59:02 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4R5WS1161nzLnsJ; Wed, 19 Jul 2023 17:56:33 +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; Wed, 19 Jul 2023 17:58:59 +0800 From: Peng Zhang To: , , CC: , , , , ZhangPeng Subject: [PATCH v2 9/9] mm/page_io: convert bio_associate_blkg_from_page() to take in a folio Date: Wed, 19 Jul 2023 17:58:48 +0800 Message-ID: <20230719095848.3422629-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230719095848.3422629-1-zhangpeng362@huawei.com> References: <20230719095848.3422629-1-zhangpeng362@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 fa8caf1c05d8..dcb58888dd36 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); -- 2.25.1