]> git.baikalelectronics.ru Git - kernel.git/commitdiff
mm: damon: use HPAGE_PMD_SIZE
authorKefeng Wang <wangkefeng.wang@huawei.com>
Tue, 17 May 2022 14:51:20 +0000 (22:51 +0800)
committerakpm <akpm@linux-foundation.org>
Thu, 19 May 2022 21:08:55 +0000 (14:08 -0700)
Use HPAGE_PMD_SIZE instead of open coding.

Link: https://lkml.kernel.org/r/20220517145120.118523-1-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Reviewed-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/ops-common.c
mm/damon/paddr.c
mm/damon/vaddr.c

index e346cc10d1439aa0241f64d95ba29a310d14391f..10ef20b2003f5c340a4685e58fa81b2e66ffbb6c 100644 (file)
@@ -73,8 +73,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct mm_struct *mm, unsigned long addr)
        }
 
 #ifdef CONFIG_MMU_NOTIFIER
-       if (mmu_notifier_clear_young(mm, addr,
-                               addr + ((1UL) << HPAGE_PMD_SHIFT)))
+       if (mmu_notifier_clear_young(mm, addr, addr + HPAGE_PMD_SIZE))
                referenced = true;
 #endif /* CONFIG_MMU_NOTIFIER */
 
index 21474ae63bc7a8807a79f074b89c9b5e998daafe..b40ff5811bb226a9bc764ad5a3d5689ee3ec239d 100644 (file)
@@ -106,7 +106,7 @@ static bool __damon_pa_young(struct folio *folio, struct vm_area_struct *vma,
                        result->accessed = pmd_young(*pvmw.pmd) ||
                                !folio_test_idle(folio) ||
                                mmu_notifier_test_young(vma->vm_mm, addr);
-                       result->page_sz = ((1UL) << HPAGE_PMD_SHIFT);
+                       result->page_sz = HPAGE_PMD_SIZE;
 #else
                        WARN_ON_ONCE(1);
 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
index 77f326323e74716cb21307a1d12e2f0ca854f1fa..59e1653799f83f56842febcda023bbe3e496adab 100644 (file)
@@ -442,7 +442,7 @@ static int damon_young_pmd_entry(pmd_t *pmd, unsigned long addr,
                if (pmd_young(*pmd) || !page_is_idle(page) ||
                                        mmu_notifier_test_young(walk->mm,
                                                addr)) {
-                       *priv->page_sz = ((1UL) << HPAGE_PMD_SHIFT);
+                       *priv->page_sz = HPAGE_PMD_SIZE;
                        priv->young = true;
                }
                put_page(page);