Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp503614rdf; Fri, 3 Nov 2023 07:04:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG59hLJvX7EJMSErYPeuqovBZSMMY/qDJDAAd92j7HURvzh6tXALkJTRKfimrgsPic0ZEo3 X-Received: by 2002:a05:6a20:1585:b0:15d:9ee7:180a with SMTP id h5-20020a056a20158500b0015d9ee7180amr21395428pzj.4.1699020297345; Fri, 03 Nov 2023 07:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699020297; cv=none; d=google.com; s=arc-20160816; b=zAr4OAkmMn9NoxbuTwixQ+lMtXjx1yYvSaKHC8CwL1mV609iiM+KvdaHpnaAHXMbNT 4jIBN2myk2UXMelErPqgatNrwQFPDjhf/nDXAO1OvHgepmIYgh18YAGKUfCFSSkNH20x hnz1JGpZT5FPMr/3foi+fG9DWOcZ6nFvrY3c03kXpUCAuNelmN4rrGZBowFQxMeqPDHS VZpThgeLR8qNTQAkWG1YDbJVNKiXylIi3kS5lmm9y3jmLPlDIYYDhYHJrsq/IwExU4Mm 6VHKJGyuEvq7OzAzXdMT6SYLyMiYoTnxeinht1MD7Sguw/P+fPsrakQLKLSOjgyTka1W Ooaw== 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:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id bw33-20020a056a0204a100b0058a4883e6casi1699694pgb.225.2023.11.03.07.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 33D80829EA02; Fri, 3 Nov 2023 07:04:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377839AbjKCOD5 (ORCPT + 99 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 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=-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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Fri, 03 Nov 2023 07:04:51 -0700 (PDT) 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; -- 2.27.0