Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp533416rdf; Fri, 3 Nov 2023 07:47:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFo+Lksiy4ZaBsCPi0zRdQ7nmQwLqWscAV2v6CoDLlcGHpcXzHN3OsVJpalHAW3J27/fWgs X-Received: by 2002:a05:6a20:430d:b0:171:a2df:4e68 with SMTP id h13-20020a056a20430d00b00171a2df4e68mr22526537pzk.36.1699022855351; Fri, 03 Nov 2023 07:47:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699022855; cv=none; d=google.com; s=arc-20160816; b=h4isyKeJgqv6BHQ2Jabs1GKcrZXCkQJCvDp722D9m1324UpsdkeKkL4AyC3wWGHl5h mMKYJbDut0ZszCPRuEi28xzqOp24tgp/+3AzmwtCU3oZsjgPCiaeAvEuePz+F2gdyPit skYVEkmdtc6rX1i3ni+Gsezet81cIyp99i86ZklKjxGx6j9cNrt0kYLMmCx5HQJxMyiw Q1pzqAbF3cZMAYTk34RXcTwUUpqP+EhaYb8TDfgFVAbL0T9vgxWCnvzUGoWhTMvJCjAo q3e+kATg9VGmHCO3Ls2GBtJmtdv1Br2VpFRgyriGzIjuIKpvKNpc5k83hr4/JJkMJ6og NffA== 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=BksiekM5fz6UlJeefImo+WZsurm9oK7d4R0JBiKe41Q=; fh=kUj/5waaepfljbNx30rj2BALdV0u/mUCTaFWThlgquQ=; b=MZeCrBKBKra8HU6EyOcTg5NHhvQp+c8u6CccezG+uhcFORHGwy21ZI4O3c6njoq2if w/GUFmRzd8PLdavE2PnlAdKO16LEOLUY56HUzxOEFLDb1yHlnEIiaWaj2uLerUPj7JEr VCQDlGXZNdF7gasULrGqrc1vXHiLtvitPystg5J6X19gdYFOQD8RTIMM81+vhUbC5MTl EoTFk7U5U+HRckD5yjxbOozuBzUaDhFNho3vvmqWtojxavgCvXOJvGB2nl+vJto7BGvc u1LILNpOaF5m6a1rj9essLoADb170j1MWzFHNP5oZRKqTkHym9gSgLs0OSy/NQyP4fWe VDHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e17-20020a656bd1000000b005b881cc9497si1693439pgw.320.2023.11.03.07.47.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:47:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2A7588095023; Fri, 3 Nov 2023 07:46:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbjKCOqD (ORCPT + 99 others); Fri, 3 Nov 2023 10:46:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377815AbjKCODz (ORCPT ); Fri, 3 Nov 2023 10:03:55 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46012D62; Fri, 3 Nov 2023 07:03:51 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SMMpP5g8Gz1P7nl; Fri, 3 Nov 2023 22:00:45 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 3 Nov 2023 22:03:46 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , , Kefeng Wang Subject: [PATCH 08/18] mm: khugepaged: use mm_counter_file_folio() in collapse_pte_mapped_thp() Date: Fri, 3 Nov 2023 22:01:09 +0800 Message-ID: <20231103140119.2306578-9-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231103140119.2306578-1-wangkefeng.wang@huawei.com> References: <20231103140119.2306578-1-wangkefeng.wang@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: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100001.china.huawei.com (7.185.36.93) 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 07:46:11 -0700 (PDT) Use mm_counter_file_folio() to save two compound_head() calls in mm_counter_file_folio(). Signed-off-by: Kefeng Wang --- mm/khugepaged.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 064654717843..a6805f4f6dea 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -1630,7 +1630,7 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, /* step 3: set proper refcount and mm_counters. */ if (nr_ptes) { folio_ref_sub(folio, nr_ptes); - add_mm_counter(mm, mm_counter_file(&folio->page), -nr_ptes); + add_mm_counter(mm, mm_counter_file_folio(folio), -nr_ptes); } /* step 4: remove empty page table */ @@ -1661,7 +1661,7 @@ int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, if (nr_ptes) { flush_tlb_mm(mm); folio_ref_sub(folio, nr_ptes); - add_mm_counter(mm, mm_counter_file(&folio->page), -nr_ptes); + add_mm_counter(mm, mm_counter_file_folio(folio), -nr_ptes); } if (start_pte) pte_unmap_unlock(start_pte, ptl); -- 2.27.0