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: 13444575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98636C4332F for ; Fri, 3 Nov 2023 14:04:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2AF6B280029; Fri, 3 Nov 2023 10:04:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 25FAA28001D; Fri, 3 Nov 2023 10:04:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 127D9280029; Fri, 3 Nov 2023 10:04:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 040AD28001D for ; Fri, 3 Nov 2023 10:04:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id D187940ECA for ; Fri, 3 Nov 2023 14:04:36 +0000 (UTC) X-FDA: 81416813352.13.38D0781 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf11.hostedemail.com (Postfix) with ESMTP id 1A77140021 for ; Fri, 3 Nov 2023 14:04:33 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699020274; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kykwL6Mmf1y36nJByARdqQ9uHESO9i+gC6/3JI+7xuE=; b=UU1XL/IUwI/v262ppeoU9AZl5ZcdntYrW9KxZbvqyWZ7XCNuXKLe9kRCSLbt659CiRswGg vPgladCGyehxWqWtmkUaH6BbYXQoh4mbflwMs9k3FwVQMojWkCGUDFcj4mbebWuMBdDsie jGRVK2wiv9n+nUtDM6QqkYL5Yvwl0mw= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699020274; a=rsa-sha256; cv=none; b=2GZc28KDpePtgGekSoSGHlCgAePUS+nVkfQx2pAjD3lP0ov/fnO+eJ2o4tazeR0JvJkM9H 6yD1mBHaRY/xt5tOHd/6mPFUFHWnc+1dTioWtS3QLrTFEzHiabL/+WNKAOupE8a2H/J9ZS 4Paq+tCfTPjoJ6f4NgfFoXR5HUM2l5s= 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-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1A77140021 X-Stat-Signature: rjekz1n7mgqi71uhqgdoqhgs5onw1yz8 X-HE-Tag: 1699020273-422082 X-HE-Meta: U2FsdGVkX19xeQbr541A2Aw7A8DcjU3p01JZ0ILkf7AGBBk5gLywDqSMdpE2jUerG+3O0KYi0G/v9tjNiOzeocLUKqBl5yCD8SKjesSFtNk+qKxyPDF51exxZ7EYN3cO46B4q9jnn8QxpLO7i+67yOz+NL9lYmu5w1wAuc4OcRl7CNOkyimMzpcZi47jHECdrdLh0+u8jmO+SmM5cYVrCCHI/dcnuQZvzkTWls/KpzIFXxaOii6lH8w/EPo2oGHRk8hE2kffspvlYCWymiXhPuIxDkMysme92wBUf/O5+DMTHw4+DqjSLvtLw0Pf774cSu8v+mfeqiEe7urHibzxk0UACO60bRMiRAfO0XBE+8ZTIBwGJ7yVBBaCF0Bj7cLx+hFO8K70GqqpI9SGwgqwaPfRFOJjlPUjzLiMTVw9z9IYHmUZz0LAwqJ76v8rbqZuB7imQglQY6Z5stFTWdxWOW2DWB7S2BsU9mmPlX+R6/kt+9BPSNsZU+aanp0xP2BeR3ZIxzJVIAuU1Lh+SXXqwVvwKCK5QMiFrohj36eFeaJrJ57OQsvo1druT+oQmi20KgFNCgINonj8/h1z+rUPcDqXBPmH9ViXXlPL0MVQ79HTtETQyLOwPGj7CRLHlIkc0cxdiQoYZDDtckDZLxKMMmXSwU4WOByofm+O/897wr1j/fRoWewO6eBo4JTIlWIWYOljXBKMjPGEqC46AdXqypUCuckfejpwvQEL+YXMj7+9tBjBH6KN0zW6ixPPBGDiqAeOrnaXIptPq+yOgEXLldLnrnE6zzuQxRybGB+igNVqDD2KiraZZKiqc1oABVohipvZ4Dsj+KDYQOvVDOXwtAcl8Y3nUkt33vacUYvagAL44893ozAOFDCH+3WK/xG5nL+IZwAGAqhEasTZWAC6WA4m0t/eVIccLoXiT4MwR2HI8XIU+Gp3Zv6IgnVLLVtMJh6BKab2173fXMlQsbu 0qF8g9wb LtXEZ599Ku/rzruONBLt3+0xoQIH3FuYPjtjY2h5kepp5o7P+OtZGTj7XrgM+OKb25NnZWlM+Zf9STn/kD/qbj4gUaabCih6OgGm+LpoXe5k/zi4d/E6PEw1XDcdTPPrlcpCOZvefgQosUjvPcfKCC+rScn1V4G043IozMKgXx79ycG8txul+hD1OYC9e5CBYJkFK X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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;