Commit ed1523a8 authored by Baolin Wang's avatar Baolin Wang Committed by Andrew Morton
Browse files

mm/damon: use set_huge_pte_at() to make huge pte old

The huge_ptep_set_access_flags() can not make the huge pte old according
to the discussion [1], that means we will always mornitor the young state
of the hugetlb though we stopped accessing the hugetlb, as a result DAMON
will get inaccurate accessing statistics.

So changing to use set_huge_pte_at() to make the huge pte old to fix this
issue.

[1] https://lore.kernel.org/all/Yqy97gXI4Nqb7dYo@arm.com/

Link: https://lkml.kernel.org/r/1655692482-28797-1-git-send-email-baolin.wang@linux.alibaba.com


Fixes: 49f4203a ("mm/damon: add access checking for hugetlb pages")
Signed-off-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: default avatarSeongJae Park <sj@kernel.org>
Acked-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: default avatarMuchun Song <songmuchun@bytedance.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d684e0a5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -336,8 +336,7 @@ static void damon_hugetlb_mkold(pte_t *pte, struct mm_struct *mm,
	if (pte_young(entry)) {
		referenced = true;
		entry = pte_mkold(entry);
		huge_ptep_set_access_flags(vma, addr, pte, entry,
					   vma->vm_flags & VM_WRITE);
		set_huge_pte_at(mm, addr, pte, entry);
	}

#ifdef CONFIG_MMU_NOTIFIER