]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm/damon/vaddr: convert damon_young_pmd_entry() to use a folio
authorKefeng Wang <wangkefeng.wang@huawei.com>
Fri, 30 Dec 2022 07:08:47 +0000 (15:08 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 19 Jan 2023 01:12:53 +0000 (17:12 -0800)
With damon_get_folio(), let's convert damon_young_pmd_entry()
to use a folio.

Link: https://lkml.kernel.org/r/20221230070849.63358-7-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/vaddr.c

index 15f03df66db60e5db517bc73413a72e834f53563..29227b7a603248520b96a6dc6c4980452213b622 100644 (file)
@@ -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 @@ regular_page:
        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;