Commit 02e34fff authored by Kefeng Wang's avatar Kefeng Wang Committed by akpm

mm: damon: use HPAGE_PMD_SIZE

Use HPAGE_PMD_SIZE instead of open coding.

Link: https://lkml.kernel.org/r/20220517145120.118523-1-wangkefeng.wang@huawei.comSigned-off-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 2b132903
...@@ -73,8 +73,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr) ...@@ -73,8 +73,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr)
} }
#ifdef CONFIG_MMU_NOTIFIER #ifdef CONFIG_MMU_NOTIFIER
if (mmu_notifier_clear_young(mm, addr, if (mmu_notifier_clear_young(mm, addr, addr + HPAGE_PMD_SIZE))
addr + ((1UL) << HPAGE_PMD_SHIFT)))
referenced = true; referenced = true;
#endif /* CONFIG_MMU_NOTIFIER */ #endif /* CONFIG_MMU_NOTIFIER */
......
...@@ -106,7 +106,7 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma, ...@@ -106,7 +106,7 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma,
result->accessed = pmd_young(*pvmw.pmd) || result->accessed = pmd_young(*pvmw.pmd) ||
!folio_test_idle(folio) || !folio_test_idle(folio) ||
mmu_notifier_test_young(vma->vm_mm, addr); mmu_notifier_test_young(vma->vm_mm, addr);
result->page_sz = ((1UL) << HPAGE_PMD_SHIFT); result->page_sz = HPAGE_PMD_SIZE;
#else #else
WARN_ON_ONCE(1); WARN_ON_ONCE(1);
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
......
...@@ -442,7 +442,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr, ...@@ -442,7 +442,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
if (pmd_young(*pmd) || !page_is_idle(page) || if (pmd_young(*pmd) || !page_is_idle(page) ||
mmu_notifier_test_young(walk->mm, mmu_notifier_test_young(walk->mm,
addr)) { addr)) {
*priv->page_sz = ((1UL) << HPAGE_PMD_SHIFT); *priv->page_sz = HPAGE_PMD_SIZE;
priv->young = true; priv->young = true;
} }
put_page(page); put_page(page);
......
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