From patchwork Fri Nov 3 14:01:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 161326 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1088047vqu; Fri, 3 Nov 2023 07:46:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF4PuNLT1yN5WISlSoijOm44739KOQh5uGaY0OwSQnkU3ZCL31yCY+mbXNZg9W/a2lTHqfJ X-Received: by 2002:a17:902:e1cd:b0:1c7:49dd:2df with SMTP id t13-20020a170902e1cd00b001c749dd02dfmr15680380pla.32.1699022802539; Fri, 03 Nov 2023 07:46:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699022802; cv=none; d=google.com; s=arc-20160816; b=0U+yu1kPBMCbIu2iGYjRW4NpQ0ufsrlzZCuIRF2/huF7DGWHNFljYJz0+1eTzX6hdg UTlo8GCSD8AD5k/1IUQQWTt+OCp57uW01/8NDL95E5jyX8Ii+0y3EeWZTGsHxqlUGIK1 WBC2pbF5omG0WvNMkLDqHa/S9McpVLVoy+pHCRIxg+QoNwmPeGUciWrXDbLmQgChhaGG 5AgbCwSa3ivfcbF621nn7adNA0hQ0f24C8OIHm+XUQNqvEZPpYDJ9J3cxv/jHRglSovZ 8bj955gIbPK321H41fjjdyOb/wav58CVSSH1Jdgfyw3+Kkl1Ew262tHTHFQOZA/p+mpl tuDg== 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:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id ix19-20020a170902f81300b001c9bdaa81e3si1565548plb.633.2023.11.03.07.46.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:46:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 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 groat.vger.email (Postfix) with ESMTP id EB1268303A2B; Fri, 3 Nov 2023 07:46:39 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231510AbjKCOqD (ORCPT + 36 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 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=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email 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 (groat.vger.email [0.0.0.0]); Fri, 03 Nov 2023 07:46:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781554534543999946 X-GMAIL-MSGID: 1781554534543999946 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);