From: SeongJae Park <sj@kernel.org>
To: Enze Li <lienze@kylinos.cn>
Cc: SeongJae Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
linux-mm@kvack.org, enze.li@gmx.com
Subject: Re: [PATCH] mm/damon/core: delete damon_target when detected invalid
Date: Tue, 9 Dec 2025 02:49:51 -0800 [thread overview]
Message-ID: <20251209104952.43233-1-sj@kernel.org> (raw)
In-Reply-To: <87v7igm2hq.fsf@>
On Tue, 09 Dec 2025 17:24:49 +0800 Enze Li <lienze@kylinos.cn> wrote:
> Hi SJ,
>
> On Mon, Dec 08 2025 at 11:21:45 PM -0800, SeongJae Park wrote:
>
> > On Tue, 9 Dec 2025 13:57:13 +0800 Enze Li <lienze@kylinos.cn> wrote:
> >
> >> Currently, DAMON does not proactively clean up invalid monitoring
> >> targets during its runtime. When some monitored targets exit, DAMON
> >> still makes the following unnecessary function calls,
> >>
> >> --damon_for_each_target--
> >> --damon_for_each_region--
> >> damon_do_apply_schemes
> >> damos_apply_scheme
> >> damon_va_apply_scheme
> >> damos_madvise
> >> damon_get_mm
> >>
> >> and it is only in the damon_get_mm() that it may finally discover that
> >> the monitoring target no longer exists.
[...]
> > So, from the beginning part of the patch description, I understand your concern
> > is the unnecessary function calls in kdamond_apply_schemes(). What about
> > checking the target validness using ctx->ops.target_valid() and avoid going
> > deeper if it is invalid? Seems the damon_for_each_target() loop is a good
> > point to do this.
> >
> > What do you think?
>
> Excellent suggestion! Moving the validity check to the
> damon_for_each_target() loop via ctx->ops.target_valid() would indeed
> prevent all unnecessary function calls, which is more efficient and
> architecturally cleaner than my original approach. :)
>
> I will implement this change shortly.
>
> By the way, I'll add a "Suggested-by" tag to the commit message, if
> that's okay with you.
Surely that's okay and my honor :)
Thanks,
SJ
[...]
prev parent reply other threads:[~2025-12-09 10:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-09 5:57 [PATCH] mm/damon/core: delete damon_target when detected invalid Enze Li
2025-12-09 7:21 ` SeongJae Park
2025-12-09 9:24 ` Enze Li
2025-12-09 10:49 ` SeongJae Park [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251209104952.43233-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=enze.li@gmx.com \
--cc=lienze@kylinos.cn \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.