Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10422372rwp; Thu, 20 Jul 2023 21:48:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlG9jF43sO9RX74uUs5K5pI31vcKwfvzuQymhnBNhxTmyYUtXYG5iifdNqjPWmjRi8tpMHe3 X-Received: by 2002:a17:906:77d9:b0:99b:4edc:8a00 with SMTP id m25-20020a17090677d900b0099b4edc8a00mr780208ejn.37.1689914921896; Thu, 20 Jul 2023 21:48:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689914921; cv=none; d=google.com; s=arc-20160816; b=kGX17ilS3k1Q8OrUCkDjA3FASKgbHGbHveb/kT3YclAjbLx6GikXNRMmc0nxtdyFWz 41OFUvz0fDIpUdmy0A7GVXUxon/ck8CkGPA32LohmbPCBqkV5jb+1pKd3AXHo9LqT2hu B8kqAPr9ipRyetCLvfUlGqobmiIaoFZ5oHtZoAGB4TQZa7Bq2/FPx5hkeD5xvHnDqHST lzgcr3ZFSmWfZlXEAa16kmicUlOcEcqYCdWR6qx0c1NCjB0vWRHn77g8L3sg2vEUeRi5 7vKR7M5Cn7VRrh9tbYPzEDf5O7Ky+YeWMAnqeTPaTxYUQjaEd/5dob8W6U18gBfr6FHF IJEw== 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=2/8lQu2NaqApJJJ+XOK2DzlbE6EAGV4Nr6XhHRmOd70=; fh=q8rOnvZaN5Z50YvgZS1uBArX5ZcEEwPcusRFazgmNUQ=; b=a+Zv13SrH+qQFviRB0BJskE38AadK2iuWLn9aI1FWELfLIQvLOIT6qvR5GrVAEoZM/ Py9NkuscJwjdwQbPKEqiBVC6DCNqKeenLdY5cqTh1cFTeLQ8lsVpBaRiX104STdXIRnf 4OQ5FaWXN2nd06HklLMIrQ3rBUKuUW9eMuRcq5l/Rts+5Gq61cgzEMg0QK0WRoUv8ddb Z3pM9k67ktNsnCU5GwVjnz356mQN8F7w1msRxTzkSDDrtJIcqtZcNCdgG1pbI/RjYfiq KestpSFEHQ+PPCil/VK6o3s2NeV/GHVPIl+GvgSQm7DPOvUNj97Lovdyz7dp8VTnLh90 3oLg== 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 i18-20020a17090639d200b0099367e9043dsi1737199eje.870.2023.07.20.21.48.18; Thu, 20 Jul 2023 21:48:41 -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 S230191AbjGUDpn (ORCPT + 99 others); Thu, 20 Jul 2023 23:45:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbjGUDpR (ORCPT ); Thu, 20 Jul 2023 23:45:17 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BACF1BFC for ; Thu, 20 Jul 2023 20:45:16 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4R6b5m5fdHz18MC6; 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 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Fri, 21 Jul 2023 11:44:50 +0800 Message-ID: <20230721034451.16412-10-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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 07bad3a4b701..f575c0bf545e 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