From patchwork Fri Nov 3 14:01:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 161306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1055423vqu; Fri, 3 Nov 2023 07:03:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFNhXuRrMxWAZ2qtjtaxg6AShWr5RHMShm97Bo0xtF3g8sUqdN56lRjihx2Mc+CWD2//D8Y X-Received: by 2002:a05:6a20:42a5:b0:140:6979:295d with SMTP id o37-20020a056a2042a500b001406979295dmr22352408pzj.2.1699020239252; Fri, 03 Nov 2023 07:03:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699020239; cv=none; d=google.com; s=arc-20160816; b=AKn+WAd/Jr1HAhgDvqzqJgaY0iLdyRf+aRuKzbdl0mCUgy0WFTWAC8W0UnRCgVKJQL +JkXBryNfH/VNnIBKwwQYR5QZsGlvQ1AnZ9xMNlh3ydue+vMgJ0niXYOH/6FdpxUqQ2w sBNtUNc6J1fOjZS29MibjOwlCCbx5d3zYLN69n8B+JtS5L+LPoZGDQtyR17TSiA51WmH R6N1puIZvkJmYvPpSnjkHsFA3YIhtv/NcEh0/n23QaBFgau7VpLxt7noTgjJuIEVs8au jtTVn1Ivm+D9hqxPm8n5L1vxF8OX2Hzzgk+PMtjB6Fnf5tPBFwrAvBfkGEJg8RrFXWVN 5F1w== 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=kykwL6Mmf1y36nJByARdqQ9uHESO9i+gC6/3JI+7xuE=; fh=kUj/5waaepfljbNx30rj2BALdV0u/mUCTaFWThlgquQ=; b=sUkzk1k4Atp8to6n+TsZCUS5hdEkA1r3TDk60ITZybcfQz9/SreH6oX36L3AXy0ur+ 5NFifWSdkZChZvhQW300QnXG4CGlIvjAeKDIgHoFzzLZf6TAU6/abnziwWr/vphf0pZe 0ho69aikw5vh5H6FsTu1zzjpwuDWnARVsmOWVe480ysp4xN7CDpcMoQHSoJSvgq6TWK5 5/uIpbarJtL3Pm2W91X0TRAD+xQrCbs+M/xJJNwEulnFjyDA6076HxDrWCkbxlDgOy/U 6Qm9kIF6PFMYQ7ksSZnLIShg4QKSCHb4Uk5tCCVFnscfHAm1PL/1c9atqqc9P/43lleU ufqg== 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 Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l4-20020a63ea44000000b005694a4640afsi1574656pgk.95.2023.11.03.07.03.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:03:59 -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 CBDB1803E498; Fri, 3 Nov 2023 07:03:57 -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 S1377842AbjKCOD5 (ORCPT + 36 others); Fri, 3 Nov 2023 10:03:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233909AbjKCODt (ORCPT ); Fri, 3 Nov 2023 10:03:49 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22DDD4E; Fri, 3 Nov 2023 07:03:46 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SMMmn4xy3zMmLd; Fri, 3 Nov 2023 21:59:21 +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:44 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , , Kefeng Wang Subject: [PATCH 04/18] mm: rmap: use mm_counter_[file]_folio() Date: Fri, 3 Nov 2023 22:01:05 +0800 Message-ID: <20231103140119.2306578-5-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=-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:03:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781551846140587981 X-GMAIL-MSGID: 1781551846140587981 Use mm_counter_folio() and mm_counter_file_folio() to save five compound_head() calls. Signed-off-by: Kefeng Wang --- mm/rmap.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index 7a27a2b41802..9d77975eaa35 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -1678,7 +1678,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, set_huge_pte_at(mm, address, pvmw.pte, pteval, hsz); } else { - dec_mm_counter(mm, mm_counter(&folio->page)); + dec_mm_counter(mm, mm_counter_folio(folio)); set_pte_at(mm, address, pvmw.pte, pteval); } @@ -1693,7 +1693,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, * migration) will not expect userfaults on already * copied pages. */ - dec_mm_counter(mm, mm_counter(&folio->page)); + dec_mm_counter(mm, mm_counter_folio(folio)); } else if (folio_test_anon(folio)) { swp_entry_t entry = page_swap_entry(subpage); pte_t swp_pte; @@ -1801,7 +1801,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, * * See Documentation/mm/mmu_notifier.rst */ - dec_mm_counter(mm, mm_counter_file(&folio->page)); + dec_mm_counter(mm, mm_counter_file_folio(folio)); } discard: page_remove_rmap(subpage, vma, folio_test_hugetlb(folio)); @@ -2075,7 +2075,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, set_huge_pte_at(mm, address, pvmw.pte, pteval, hsz); } else { - dec_mm_counter(mm, mm_counter(&folio->page)); + dec_mm_counter(mm, mm_counter_folio(folio)); set_pte_at(mm, address, pvmw.pte, pteval); } @@ -2090,7 +2090,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, * migration) will not expect userfaults on already * copied pages. */ - dec_mm_counter(mm, mm_counter(&folio->page)); + dec_mm_counter(mm, mm_counter_folio(folio)); } else { swp_entry_t entry; pte_t swp_pte;