void damon_pmdp_mkold(pmd_t *pmd, struct vm_area_struct *vma, unsigned long addr)
{
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- struct folio *folio = damon_get_folio(pmd_pfn(*pmd));
+ struct folio *folio = damon_get_folio(pmd_pfn(pmdp_get(pmd)));
if (!folio)
return;
mmu_notifier_test_young(vma->vm_mm, addr);
} else {
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- *accessed = pmd_young(*pvmw.pmd) ||
+ *accessed = pmd_young(pmdp_get(pvmw.pmd)) ||
!folio_test_idle(folio) ||
mmu_notifier_test_young(vma->vm_mm, addr);
#else
unsigned long next, struct mm_walk *walk)
{
pte_t *pte;
+ pmd_t pmde;
spinlock_t *ptl;
- if (pmd_trans_huge(*pmd)) {
+ if (pmd_trans_huge(pmdp_get(pmd))) {
ptl = pmd_lock(walk->mm, pmd);
- if (!pmd_present(*pmd)) {
+ pmde = pmdp_get(pmd);
+
+ if (!pmd_present(pmde)) {
spin_unlock(ptl);
return 0;
}
- if (pmd_trans_huge(*pmd)) {
+ if (pmd_trans_huge(pmde)) {
damon_pmdp_mkold(pmd, walk->vma, addr);
spin_unlock(ptl);
return 0;
struct damon_young_walk_private *priv = walk->private;
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
- if (pmd_trans_huge(*pmd)) {
+ if (pmd_trans_huge(pmdp_get(pmd))) {
+ pmd_t pmde;
+
ptl = pmd_lock(walk->mm, pmd);
- if (!pmd_present(*pmd)) {
+ pmde = pmdp_get(pmd);
+
+ if (!pmd_present(pmde)) {
spin_unlock(ptl);
return 0;
}
- if (!pmd_trans_huge(*pmd)) {
+ if (!pmd_trans_huge(pmde)) {
spin_unlock(ptl);
goto regular_page;
}
- folio = damon_get_folio(pmd_pfn(*pmd));
+ folio = damon_get_folio(pmd_pfn(pmde));
if (!folio)
goto huge_out;
- if (pmd_young(*pmd) || !folio_test_idle(folio) ||
+ if (pmd_young(pmde) || !folio_test_idle(folio) ||
mmu_notifier_test_young(walk->mm,
addr))
priv->young = true;