From patchwork Tue Dec 27 12:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13082240 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 D0F28C4332F for ; Tue, 27 Dec 2022 12:11:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B63C58E0007; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B598D8E0006; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 937408E0007; Tue, 27 Dec 2022 07:11:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6CD868E0001 for ; Tue, 27 Dec 2022 07:11:40 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3273A160C35 for ; Tue, 27 Dec 2022 12:11:40 +0000 (UTC) X-FDA: 80287971960.19.1558BD3 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf27.hostedemail.com (Postfix) with ESMTP id 0503040005 for ; Tue, 27 Dec 2022 12:11:37 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 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=1672143098; 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=rnhzB6T4tsOkxbilNdxJPGRrXwW2//vST41rcZs8s/g=; b=pn6x1peu95eM99EW9bxz/oTV1ow9bUqQ1d0bXFzYDlRvhKkwFIowVoxu6pDcTgnwobjFf4 8L047j5j08mI4wez+xY244GQ+pmlyTR9rWiktQTK0im52lyvULfRNjmA7kU0ksqS0VeNSc AvVY0pAFeKpsXgBQAmXYHSk87zet2uw= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf27.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672143098; a=rsa-sha256; cv=none; b=vnC4v2wgSwvAwA9Ja86y8qRyEWlMPEeQZamICE1MiII5CE9fhc609+HtKiwxYj12fUl8bS JwcRqMxPENkR/tC2WV6CZAQDf05My/CeChbSdImsVrAjyhpgHulUG9hhbcFYjpjxcQE2fk 83JNl45OVfJrpv6YTHGbXEJI7CH/6I4= Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NhD0m0Xr6zkWty; Tue, 27 Dec 2022 20:07:04 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Tue, 27 Dec 2022 20:11:34 +0800 From: Kefeng Wang To: Andrew Morton , SeongJae Park CC: , , , , , Kefeng Wang Subject: [PATCH -next v2 5/7] mm: damon: vaddr: convert damon_young_pmd_entry() to use folio Date: Tue, 27 Dec 2022 20:27:12 +0800 Message-ID: <20221227122714.161224-6-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221227122714.161224-1-wangkefeng.wang@huawei.com> References: <20221227122714.161224-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 0503040005 X-Stat-Signature: m8tk6aejmej71dut6n6zhnmzztoqhrsx X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1672143097-674146 X-HE-Meta: U2FsdGVkX18mmyv8Aqebo2G5g3+BHMaxXIzzCLG3QAIGR01h0k/qh/lawF9EC1sYNHueB3uzxcDcylsSHItaYiwn7NVqqyD3S10b+RPBuVRijHIf2GGoWpP9+iomA6n120un+G0cHHB/fLJ3MnZwCk6T3iw8dDUpiL2KYlb8qmzltrQFv7RUqvULmBt7dYs6S7PcGdT9bUhU/HujnF/joCs4kMiCudPNlI9uj8gdAWDkqKj3TFqd5ufmYI7aVpdWVSVbKxXr0TzVUA+YP9THbMvDTbFM+lkkKGdejoQ7oS4a2/VKklS9muVfK8oLz2GjHFoflzROaCk2r1cTYMcCI1eqnXW0tJgV1WrjEn74uMrM+G0Hn4R7eJMju7FO3zaDOJMNf5UsxfBoDkH+6qwGuhlrZ8gvEXlGbTON8LY52UVlmv4+yrZ17XnGzXWUIVDOepqpsBW7OlSxta/bAwxjXgMuKAXFW7eM8E1QGtGV0vYMyGzWFoQXCEcojpmhFp8ooFP/XgDcgxbWrpue6Ji9V0ZjqPKO3pl3FfLn5+uISPowP4Z1xVfVyDI71Mqzr9IJNY2AuoYG+IW7aHUdSKcsZZeODcs35CBX+FLEWg9UgBKU15Uooy/HDy6GqNpmNRJk446GJIb5w9pwjQg8DFr6l1vFmZ/Jo5FW06Qwx2zprOMvXCnNi4d/1A6l6opToxIoVsRkjnxX9ACAFuIdCLIBrLMYNtkAA0DGYwPQjndWPVyQ6YkmOqdEcW1oPaM4I5KjjhQwwK4BZEwgySxmtPGzKmaHDYgHwycRlQznIGBH6yaedRVVTl25uhTCF+Ulp1sB5aS7AikUqGFP8TdAAHJSPlOUHEGQf3sg/25W+GVsIPNunw7NVAOn6l8AkOAeOAXpceGzriKpVyD4QbmVivLae1/iuW3z4e5gvRcJEHFln1AlqxVtpiRLVEoYWslgD+Rub6NOXRdsNW7r2cCFGh7 AlXDLsA0 pqnfNxz3RlY3IqXE= 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: With damon_get_folio(), let's convert damon_young_pmd_entry() to use folios. Signed-off-by: Kefeng Wang --- mm/damon/vaddr.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c index 15f03df66db6..29227b7a6032 100644 --- a/mm/damon/vaddr.c +++ b/mm/damon/vaddr.c @@ -431,7 +431,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, { pte_t *pte; spinlock_t *ptl; - struct page *page; + struct folio *folio; struct damon_young_walk_private *priv = walk->private; #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -446,16 +446,16 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, spin_unlock(ptl); goto regular_page; } - page = damon_get_page(pmd_pfn(*pmd)); - if (!page) + folio = damon_get_folio(pmd_pfn(*pmd)); + if (!folio) goto huge_out; - if (pmd_young(*pmd) || !page_is_idle(page) || + if (pmd_young(*pmd) || !folio_test_idle(folio) || mmu_notifier_test_young(walk->mm, addr)) { *priv->page_sz = HPAGE_PMD_SIZE; priv->young = true; } - put_page(page); + folio_put(folio); huge_out: spin_unlock(ptl); return 0; @@ -469,15 +469,15 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, pte = pte_offset_map_lock(walk->mm, pmd, addr, &ptl); if (!pte_present(*pte)) goto out; - page = damon_get_page(pte_pfn(*pte)); - if (!page) + folio = damon_get_folio(pte_pfn(*pte)); + if (!folio) goto out; - if (pte_young(*pte) || !page_is_idle(page) || + if (pte_young(*pte) || !folio_test_idle(folio) || mmu_notifier_test_young(walk->mm, addr)) { *priv->page_sz = PAGE_SIZE; priv->young = true; } - put_page(page); + folio_put(folio); out: pte_unmap_unlock(pte, ptl); return 0;