Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7958673rwp; Wed, 19 Jul 2023 03:06:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbyZc/S3smZ/Ix2cZpQAH3+5W/RjQ8QXbSry0FlIaKlQbMVpgB4oLQoC60Apt71nGh+Rvk X-Received: by 2002:a17:902:eccd:b0:1ac:3605:97ec with SMTP id a13-20020a170902eccd00b001ac360597ecmr18197740plh.62.1689761181168; Wed, 19 Jul 2023 03:06:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689761181; cv=none; d=google.com; s=arc-20160816; b=pZ8gjah2YJkDP0uvt+oyAbY+NQKJO0PVCaR3opr0COGz051RynxG4iigN+6EwhLlbg tRkAOh4JV23WxxJR/K/lm+eeBaEGDGaH8CkDORqwFnOYr/dzKc4sC95yMR9JSVvxOKLe cZCbjIH/xF348sMmnbdKE8yBbkCA8ZP2rQfrCwVZqzNbcZCdvRFyug7+vS8WfUHL791z U/+DrLzv87CA8G958BuIR9tEb9bwPNY3/zsVEM+YlyvwiAnU0QdeUgwvVxsWZmYJKJ9D WI4He4ZE53YrwlZcGyQQOc9aMU8sNz4YML853PGi8vcoVuqM7OyIpUGJg4EbxYVL2gWE o3dw== 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=h0zgsx3kKMFpGJVNCTy73NxTaUsiGD9mJb5htLkWjOM=; fh=fQ8bSAglEIUMWaW8g2fbwjC8kqQICqHTc4sMCYJe224=; b=najHAz0umBmje8hW2oKKkvszq5UAMOVdoHZ2hqbwo7e5Px6afRcDUI3jYhnItpkeHN w/UOgW4031sQMcaNCMFJCNd45OBP4lUksuNSDdk1wHhp6hkMg4OwwNQMi9wbccklcpOu vvzN7hsWbYW6Cw1EdqyYiRkRr9KKDw4HrFuE9FDqez+LbkZ4Kc2Ji5UmB3swy4ti+Mqz K3HY0SFaDY1XJXsIJnyF+cbt/G8MCiUOtQ3aXluiuGx7RyrlYBFjzrWh+GbjqHNWw1xZ PgjQsXjeebZsM41PfCIuTwY8fIcrZRS1SnSa/Ps8KbktRXFgh74kVeSmDGJX6MZw4Rgo V59Q== 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 q11-20020a170903204b00b001ae42afbf93si3122998pla.450.2023.07.19.03.06.08; Wed, 19 Jul 2023 03:06:21 -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 S230515AbjGSJ7m (ORCPT + 99 others); Wed, 19 Jul 2023 05:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230344AbjGSJ7D (ORCPT ); Wed, 19 Jul 2023 05:59:03 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72E9E69 for ; Wed, 19 Jul 2023 02:59:01 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R5WRF2wptztRbR; Wed, 19 Jul 2023 17:55:53 +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 8/9] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Wed, 19 Jul 2023 17:58:47 +0800 Message-ID: <20230719095848.3422629-9-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,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, 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 count_swpout_vm_event() to take in a folio. We can remove five implicit calls to compound_head() by taking in a folio. Signed-off-by: ZhangPeng --- mm/page_io.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index e28395331bb0..fa8caf1c05d8 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc) return 0; } -static inline void count_swpout_vm_event(struct page *page) +static inline void count_swpout_vm_event(struct folio *folio) { #ifdef CONFIG_TRANSPARENT_HUGEPAGE - if (unlikely(PageTransHuge(page))) + if (unlikely(folio_test_pmd_mappable(folio))) count_vm_event(THP_SWPOUT); #endif - count_vm_events(PSWPOUT, thp_nr_pages(page)); + count_vm_events(PSWPOUT, folio_nr_pages(folio)); } #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) @@ -280,7 +280,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret) } } else { for (p = 0; p < sio->pages; p++) - count_swpout_vm_event(sio->bvec[p].bv_page); + count_swpout_vm_event(page_folio(sio->bvec[p].bv_page)); } for (p = 0; p < sio->pages; p++) @@ -339,7 +339,7 @@ static void swap_writepage_bdev_sync(struct page *page, __bio_add_page(&bio, page, thp_size(page), 0); bio_associate_blkg_from_page(&bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); @@ -362,7 +362,7 @@ static void swap_writepage_bdev_async(struct page *page, __bio_add_page(bio, page, thp_size(page), 0); bio_associate_blkg_from_page(bio, page); - count_swpout_vm_event(page); + count_swpout_vm_event(folio); folio_start_writeback(folio); folio_unlock(folio); submit_bio(bio); -- 2.25.1