From patchwork Wed Jul 19 09:58:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peng Zhang X-Patchwork-Id: 13318708 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 D7323EB64DA for ; Wed, 19 Jul 2023 09:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E91728004D; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 599C328004C; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4396528004D; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 343FD28004C for ; Wed, 19 Jul 2023 05:59:08 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 078758018D for ; Wed, 19 Jul 2023 09:59:08 +0000 (UTC) X-FDA: 81027913176.30.61B7B56 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf30.hostedemail.com (Postfix) with ESMTP id B85F880014 for ; Wed, 19 Jul 2023 09:59:04 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=1689760746; 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=UNTnENqbVIYj1TRfK8rpAxUpKqIh0BpIcBiqRUvXjmo=; b=TLv/6wOqKUqDLxOnZdhxpPlWtqpSxQNL626Zox5ayy19RD/VP/dEZcR54njC06cBCVKjTZ kFTtBITNTKdZDjZIX/iJoOBUxPPefsQBuubgJGoGE4sqVTohtxlnOE3erVLcspDAGP8Roz zKhhtS8Li8OFvZ9Tqc/Ew32npoP6kUg= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=none; spf=pass (imf30.hostedemail.com: domain of zhangpeng362@huawei.com designates 45.249.212.189 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=1689760746; a=rsa-sha256; cv=none; b=uuJiyTvaZ9g/rpbZsEpImkhzwcXlyih43KR/BUB11V6gy1qd7yGkjAMvm3rNMQIF1B5zRf MRAFhHff9kZclhQY2zs2AYASxBoOP9njlv4oDLrYZdkBFlqRnBa7Yt84gXhP2+aq5lhaIf CFzrufSdTSnBdGyNOHfHnRl7yMAzzZA= 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 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-Rspamd-Queue-Id: B85F880014 X-Rspam-User: X-Stat-Signature: oh41h8apdggh585349rrsqexyh5qit6e X-Rspamd-Server: rspam01 X-HE-Tag: 1689760744-106704 X-HE-Meta: U2FsdGVkX19DJVYq4XZenbkcY4Nr4ds5yf7TkK7Pe0+21/6Ee7yEeRj3AKVE3UHK2G404GbPMH/nogU8eVEmjKgMtmWY4E+qy6aJtDoYURBG4oobMapb2RcjBBv+pBb662ZYIWpRgOzvGdmTejf4vzZ6OzSaYjpiUFarHefHEAGSJFkvueV7AjuKsAwa8XRLF6/AOsOdYplREYZcOfl/g9ZI9sl7mdFTyDqjMELm2O0c8k3ZPSL0YqsjzTWklQetwj9vCo4eWw5Fl4SHH0U2HcX+AT9FZj/whuv77EgwJ1CeFLlfaH9ijK1hiPkbySdWdyuw/S+GToRUmP10z1IkMBd/uUlxDXJdF7stCWr/BQdZbWUYx4EBobZ2xddqbM/gkUZAu4ROyeHURG+h/07ObG9w/BQdZ6qy4VeY0EB2hWbz+dmCOzMjRROjHubdZbGMZ2A4yypq0zWkrM0Le5Op4Dq9I+bSwMQtYIDIpcYGLve9QoAQH1k0B070AONA3aqSNx4dDeBarqfMJMWlMy5IoTvZQZcPREETjy8/o1tD4omvjhCOilXKM68E/hDZ5ObzaEumz4hmftT9mTLASIpJbsGdUI8sxiz8XNFZYJLQ5fO9gWChGxZOaPyrSo9ygKZvdP3XDLY5djcBVKecERec4HwU67EsYT9jQFZzorsF++KfhXswCZobMZUUbBHuWyaJanBhQYIPHxoQAL+2PluVRhbiThMlKS2TsZXqT+41YczfL6qGbx4zlAtqLFjuLk2nuT83UU2JbG3FktzaUQQl2dfFRHeKAXTulB82khl5I7XSrjnvW7r/4xVvSrxUqwG6k9Kyg1V4jFPwPOUGO2xeft5Nlv+m35d+OhwNw5JMC8IMeJsin3d73J+0MAUhVvmOKP7JxhIQ2pwRZBw+qmXpJXWdRF763o1BQRg7fi5CP5G23/7j7M855fT9/cZ3OdW+UtkBBIwZXU+zGpYtZ3H UQOCJvpt VTtFc0I6DjLewwpY9whBTqGIwCXz0uDnsCoCuST8+9hlaTnum5dYWjo79ZDMzekV5TC+4ynofcCvwatoQmAXiKzE/Y2jcdPBFK0hrzl1oiqR1Cn+y/1guE+1baqCP/OoOoS4ZJxh9MDQSkpmpJU9GYEYpKbXCXCx0oBWdFKp3QDcRqzrxdGu0A1eAp8PERvXdjzGqJmPuoM7tyRQ55GC38pZQtLqKcTlAhS9GP4oczt7lvPIEDIJRahr7FA== 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 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);