linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/damon: remove redudnant mmu notifier call in pmdp mkold
@ 2026-02-03  9:54 qinyu
  2026-02-03 16:22 ` SeongJae Park
  0 siblings, 1 reply; 2+ messages in thread
From: qinyu @ 2026-02-03  9:54 UTC (permalink / raw)
  To: sj; +Cc: damon, linux-mm, qinyu

Currently, mmu_notifier_clear_young() is called immediately after
pmdp_clear_young_notify(), which already calls mmu_notifier_clear_young()
internally. This results in a redundant notifier call.

Replace pmdp_clear_young_notify() with the non-notify variant to avoid the
duplicate call and make the pmdp path consistent with the corresponding
ptep_mkold() code.

Signed-off-by: qinyu <qin.yuA@h3c.com>
---
 mm/damon/ops-common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
index a218d9922..8c6d61342 100644
--- a/mm/damon/ops-common.c
+++ b/mm/damon/ops-common.c
@@ -90,7 +90,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct vm_area_struct *vma, unsigned long addr
 		return;
 
 	if (likely(pmd_present(pmdval)))
-		young |= pmdp_clear_young_notify(vma, addr, pmd);
+		young |= pmdp_test_and_clear_young(vma, addr, pmd);
 	young |= mmu_notifier_clear_young(vma->vm_mm, addr, addr + HPAGE_PMD_SIZE);
 	if (young)
 		folio_set_young(folio);
-- 
2.33.0



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/damon: remove redudnant mmu notifier call in pmdp mkold
  2026-02-03  9:54 [PATCH] mm/damon: remove redudnant mmu notifier call in pmdp mkold qinyu
@ 2026-02-03 16:22 ` SeongJae Park
  0 siblings, 0 replies; 2+ messages in thread
From: SeongJae Park @ 2026-02-03 16:22 UTC (permalink / raw)
  To: qinyu; +Cc: SeongJae Park, damon, linux-mm, Andrew Morton

Hello qinyu,


I'd recommend to use "mm/damon/ops-common:" as the prefix of the commit
message.  Hopefully Andrew will make the modification when he adds this to the
mm tree.  For a case that Andrew might not since he must be busy for next merge
window, I will keep this patch in my tree with the subject change for a while
and repost if it is not picked up by Andrew for a while.  So you don't need to
repost this patch for the trivial change :)

On Tue, 3 Feb 2026 17:54:00 +0800 qinyu <qin.yuA@h3c.com> wrote:

> Currently, mmu_notifier_clear_young() is called immediately after
> pmdp_clear_young_notify(), which already calls mmu_notifier_clear_young()
> internally. This results in a redundant notifier call.
> 
> Replace pmdp_clear_young_notify() with the non-notify variant to avoid the
> duplicate call and make the pmdp path consistent with the corresponding
> ptep_mkold() code.

Nice catch, thank you!

> 
> Signed-off-by: qinyu <qin.yuA@h3c.com>

FWIW, Linux disallows anonymous contribution, and this tag should use a known
identity [1].  I was thinking about recommending to use real name, but I found
there are a few patches that using this identity (though email is different),
so looks fine to me.

    $ git log --author qinyu --oneline --pretty="%an <%ae>" linus/master
    Qinyun Tan <qinyuntan@linux.alibaba.com>
    qinyu <qinyu32@huawei.com>
    qinyu <qinyu32@huawei.com>
    qinyu <qinyu32@huawei.com>

[1] https://docs.kernel.org/process/submitting-patches.html#developer-s-certificate-of-origin-1-1

Reviewed-by: SeongJae Park <sj@kernel.org>

> ---
>  mm/damon/ops-common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> index a218d9922..8c6d61342 100644
> --- a/mm/damon/ops-common.c
> +++ b/mm/damon/ops-common.c
> @@ -90,7 +90,7 @@ void damon_pmdp_mkold(pmd_t *pmd, struct vm_area_struct *vma, unsigned long addr
>  		return;
>  
>  	if (likely(pmd_present(pmdval)))
> -		young |= pmdp_clear_young_notify(vma, addr, pmd);
> +		young |= pmdp_test_and_clear_young(vma, addr, pmd);
>  	young |= mmu_notifier_clear_young(vma->vm_mm, addr, addr + HPAGE_PMD_SIZE);
>  	if (young)
>  		folio_set_young(folio);
> -- 
> 2.33.0


Thanks,
SJ

[...]


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-03 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-03  9:54 [PATCH] mm/damon: remove redudnant mmu notifier call in pmdp mkold qinyu
2026-02-03 16:22 ` SeongJae Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox