Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9535983rwp; Thu, 20 Jul 2023 06:27:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlEOG/Nty4gGq7ROUkQnBe42mBeQhKbvs4ncgN345+iGTA3g12oHz02fIyAkFcsb+8w9nj5e X-Received: by 2002:a92:d0d2:0:b0:346:7503:d6f5 with SMTP id y18-20020a92d0d2000000b003467503d6f5mr8015305ila.17.1689859628953; Thu, 20 Jul 2023 06:27:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689859628; cv=none; d=google.com; s=arc-20160816; b=QuROcZvpW+AThdP+VNjIxgNATG+BiA9QxPgNojgO707NV+HxQMogYYErQHEsEWatDi I69C2xoe+gVfvDPvsPU7m58uDzERWXOq3DS8mtrQS8fv0Il4PaLEXoBSVfbW4LwZvKdn RIURc/Fb7+FBnv+UtQZf+LOb/SEwoMycpXiuy+wef/8Y28w3Q6wuFeLNC2wTGc1mg4+S EI0xgiouIbxLmvGLtgVCJZHQXmZ/NfKDg9Dduq0/x57fQxVDTDxnCRdM0uLiBOM82E5h WaAEk5msJaxmz/XO9X7/JQNAuwM7dbHay7sgkxhP7Ctf52z4Sk5Yb3U6+rNeh+IEFsZO FhbA== 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=ZiToJVy6IXCLdfNrEMRmMkKZFmbdR+n71Ox99bPoVHs=; fh=q8rOnvZaN5Z50YvgZS1uBArX5ZcEEwPcusRFazgmNUQ=; b=LINNBJh6Bl8V5qxYHoptf/eQwBojeJhTL+FNG+GeN85fdfXf9dPa0uhTQy69T0KRHV 5rocMQaNqeUQlzrx7JL9EOpdAccDJ7EsaIXS0qlTVRSVsFzvMh7tTna2Xft3a1bfff5K 8i/923Gd+VCbmvzK1NKK/y67mjlC/6l+2N+nl160H9BsmBw0pvOJgmvwqHTK6hhvqQMs UMtJKVKQh1Gd+aRn2SoJ8MjSzVyTDT/wLB8T+JwnkfKE025zyaiDsW27Dh/aGUUra9Fc nmr0X2Z+eZ83qejPEYybKmZeFmvy4TbAmW74qVr9tF2wICxOzPYl+2VHCoQU9lE2IbQY M8Ig== 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 y12-20020a634b0c000000b00563519244cdsi826934pga.625.2023.07.20.06.26.55; Thu, 20 Jul 2023 06:27:08 -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 S231683AbjGTNCl (ORCPT + 99 others); Thu, 20 Jul 2023 09:02:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231460AbjGTNC0 (ORCPT ); Thu, 20 Jul 2023 09:02:26 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35541269D for ; Thu, 20 Jul 2023 06:02:24 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R6CS53LFGzNmWS; Thu, 20 Jul 2023 20:59:01 +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; Thu, 20 Jul 2023 21:02:21 +0800 From: Peng Zhang To: , , CC: , , , , , ZhangPeng Subject: [PATCH v3 09/10] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Thu, 20 Jul 2023 21:01:46 +0800 Message-ID: <20230720130147.4071649-10-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230720130147.4071649-1-zhangpeng362@huawei.com> References: <20230720130147.4071649-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 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 07bad3a4b701..da3f38404585 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -205,13 +205,11 @@ 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 +278,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 +337,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 +360,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