* [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old
@ 2022-06-20 2:34 Baolin Wang
2022-06-20 17:27 ` SeongJae Park
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Baolin Wang @ 2022-06-20 2:34 UTC (permalink / raw)
To: sj, akpm
Cc: mike.kravetz, songmuchun, baolin.wang, damon, linux-mm, linux-kernel
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/
Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages")
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/damon/vaddr.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
index 5767be72c181..d24148a8149f 100644
--- a/mm/damon/vaddr.c
+++ b/mm/damon/vaddr.c
@@ -337,8 +337,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
--
2.27.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old
2022-06-20 2:34 [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old Baolin Wang
@ 2022-06-20 17:27 ` SeongJae Park
2022-06-21 8:45 ` Baolin Wang
2022-06-21 23:41 ` Mike Kravetz
2022-06-22 3:09 ` Muchun Song
2 siblings, 1 reply; 5+ messages in thread
From: SeongJae Park @ 2022-06-20 17:27 UTC (permalink / raw)
To: Baolin Wang
Cc: sj, akpm, mike.kravetz, songmuchun, damon, linux-mm,
linux-kernel, stable
Hi Baolin,
On Mon, 20 Jun 2022 10:34:42 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
> 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/
>
> Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages")
As the commit has merged in from v5.17, I guess it would be better to do below?
Cc: <stable@vger.kernel.org>
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Other than that,
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
> ---
> mm/damon/vaddr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 5767be72c181..d24148a8149f 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -337,8 +337,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
> --
> 2.27.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old
2022-06-20 17:27 ` SeongJae Park
@ 2022-06-21 8:45 ` Baolin Wang
0 siblings, 0 replies; 5+ messages in thread
From: Baolin Wang @ 2022-06-21 8:45 UTC (permalink / raw)
To: SeongJae Park
Cc: akpm, mike.kravetz, songmuchun, damon, linux-mm, linux-kernel, stable
Hi SeongJae,
On 6/21/2022 1:27 AM, SeongJae Park wrote:
> Hi Baolin,
>
> On Mon, 20 Jun 2022 10:34:42 +0800 Baolin Wang <baolin.wang@linux.alibaba.com> wrote:
>
>> 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/
>>
>> Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages")
>
> As the commit has merged in from v5.17, I guess it would be better to do below?
>
> Cc: <stable@vger.kernel.org>
Yes, thanks for reminding. Hope Andrew can help to add the stable tag
when picking up this patch.
>
>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>
> Other than that,
>
> Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old
2022-06-20 2:34 [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old Baolin Wang
2022-06-20 17:27 ` SeongJae Park
@ 2022-06-21 23:41 ` Mike Kravetz
2022-06-22 3:09 ` Muchun Song
2 siblings, 0 replies; 5+ messages in thread
From: Mike Kravetz @ 2022-06-21 23:41 UTC (permalink / raw)
To: Baolin Wang; +Cc: sj, akpm, songmuchun, damon, linux-mm, linux-kernel
On 06/20/22 10:34, Baolin Wang wrote:
> 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/
>
> Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages")
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Thanks,
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
--
Mike Kravetz
> ---
> mm/damon/vaddr.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 5767be72c181..d24148a8149f 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -337,8 +337,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
> --
> 2.27.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old
2022-06-20 2:34 [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old Baolin Wang
2022-06-20 17:27 ` SeongJae Park
2022-06-21 23:41 ` Mike Kravetz
@ 2022-06-22 3:09 ` Muchun Song
2 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2022-06-22 3:09 UTC (permalink / raw)
To: Baolin Wang; +Cc: sj, akpm, mike.kravetz, damon, linux-mm, linux-kernel
On Mon, Jun 20, 2022 at 10:34:42AM +0800, Baolin Wang wrote:
> 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/
>
> Fixes: 49f4203aae06 ("mm/damon: add access checking for hugetlb pages")
> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
The changes make sense to me.
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-06-22 3:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-20 2:34 [PATCH] mm/damon: Use set_huge_pte_at() to make huge pte old Baolin Wang
2022-06-20 17:27 ` SeongJae Park
2022-06-21 8:45 ` Baolin Wang
2022-06-21 23:41 ` Mike Kravetz
2022-06-22 3:09 ` Muchun Song
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.