Commit 70e314c9 authored by Kefeng Wang's avatar Kefeng Wang Committed by Andrew Morton

mm/damon: convert damon_ptep/pmdp_mkold() to use a folio

With damon_get_folio(), let's convert damon_ptep_mkold() and
damon_pmdp_mkold() to use a folio.

Link: https://lkml.kernel.org/r/20221230070849.63358-5-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarSeongJae 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: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 5e012bba
...@@ -40,9 +40,9 @@ struct folio *damon_get_folio(unsigned long pfn) ...@@ -40,9 +40,9 @@ struct folio *damon_get_folio(unsigned long pfn)
void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr) void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr)
{ {
bool referenced = false; bool referenced = false;
struct page *page = damon_get_page(pte_pfn(*pte)); struct folio *folio = damon_get_folio(pte_pfn(*pte));
if (!page) if (!folio)
return; return;
if (pte_young(*pte)) { if (pte_young(*pte)) {
...@@ -56,19 +56,19 @@ void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr) ...@@ -56,19 +56,19 @@ void damon_ptep_mkold(pte_t *pte, struct mm_struct *mm, unsigned long addr)
#endif /* CONFIG_MMU_NOTIFIER */ #endif /* CONFIG_MMU_NOTIFIER */
if (referenced) if (referenced)
set_page_young(page); folio_set_young(folio);
set_page_idle(page); folio_set_idle(folio);
put_page(page); folio_put(folio);
} }
void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr)
{ {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
bool referenced = false; bool referenced = false;
struct page *page = damon_get_page(pmd_pfn(*pmd)); struct folio *folio = damon_get_folio(pmd_pfn(*pmd));
if (!page) if (!folio)
return; return;
if (pmd_young(*pmd)) { if (pmd_young(*pmd)) {
...@@ -82,10 +82,10 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) ...@@ -82,10 +82,10 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr)
#endif /* CONFIG_MMU_NOTIFIER */ #endif /* CONFIG_MMU_NOTIFIER */
if (referenced) if (referenced)
set_page_young(page); folio_set_young(folio);
set_page_idle(page); folio_set_idle(folio);
put_page(page); folio_put(folio);
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment