Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5645803rwp; Mon, 17 Jul 2023 07:26:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEU8lnGBlrKPwBjCFr6IdzPjqcsuSLbVhXmuySXdbB37e0HOmfggfV9YqhmnJxYvMur85/J X-Received: by 2002:a17:903:1d0:b0:1b3:7de7:f83f with SMTP id e16-20020a17090301d000b001b37de7f83fmr11426161plh.26.1689604002432; Mon, 17 Jul 2023 07:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689604002; cv=none; d=google.com; s=arc-20160816; b=VkT+efo2dt6dKRYYdzM68l+oNnw/+PnGzR/fsR+Gy49p4KdFRHgDUEY9VuXGCDyViU SgFoOegSWVw9jZvUIlen6soY6wQjnDP0mVeSzLMVfyk3ePAi6tdqqYl6Xd0MKdw8jt7g 0YIHdXd7Mdd65UglZaxSwt9XI0zq+b5Xv7eSqjzH3eA39ZEwj9gA9Uh9japeNpi9TFb6 780EPr1+I70JdXXawnFNDXnkcQylRQsmU/mKr21t4sR/13c+l9x4SfE6Eob3XPblnfkl SLUzdmQ9CaDgELTiFDWdfD8DU3qu1ISrxckDYBbE2n7B/GK6I72gtt8pvohlnrHkduNz tLxA== 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=vJ+qedAJ3nl0orQtqLDDbaTMpVKcZimuaXBGhCdSkuU=; fh=VDvXH+NlXsy4uKRcyz6yvnpRC6UQTLJqNZtREhJ4J58=; b=B8nviYtgIBEdei6w5A6+wpBScLmKTMrbWVaH8L4X0+uKofYYe3sYbhuLxKEmxdINZh +WrpGBOJbbqW+UTl5PjOrW4BsJxbd0VKckm34b7Hcd5sjvpoBtm4GRUrqA6FMICz1K6o nnvmwRgNe8tpozgZBQL6LgVKIpNSWhz3fJrnPcF3/x/hE0L7KaOd3pEDlLVKq8yR8+BH T+CXW/OvBV+2PW8R6G218HGGChKnUu869vM3iesCcCR7bBdkLyTikED1t3wN6GidwBLl ejYkO0WPRr1fi9HdPgmjaT41dwdCvL8OhjdfdrGLwLXm2+EEeRC8oKbnX+oAvpOh4q9H dRsg== 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 kx14-20020a170902f94e00b001b8af83d939si11472129plb.537.2023.07.17.07.26.30; Mon, 17 Jul 2023 07:26:42 -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 S231459AbjGQN1d (ORCPT + 99 others); Mon, 17 Jul 2023 09:27:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231737AbjGQN1A (ORCPT ); Mon, 17 Jul 2023 09:27:00 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 076322117 for ; Mon, 17 Jul 2023 06:26:40 -0700 (PDT) Received: from kwepemm600020.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4R4NB24P85zrRlt; Mon, 17 Jul 2023 21:25:30 +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; Mon, 17 Jul 2023 21:26:11 +0800 From: Peng Zhang To: , CC: , , , , , ZhangPeng Subject: [PATCH 5/6] mm/page_io: convert count_swpout_vm_event() to take in a folio Date: Mon, 17 Jul 2023 21:26:01 +0800 Message-ID: <20230717132602.2202147-6-zhangpeng362@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230717132602.2202147-1-zhangpeng362@huawei.com> References: <20230717132602.2202147-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: dggems703-chm.china.huawei.com (10.3.19.180) 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 84cc9e652451..66e8403bf96e 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -208,13 +208,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_large(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) @@ -283,7 +283,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++) @@ -342,7 +342,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); @@ -365,7 +365,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