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: fix wasteful CPU calls by skipping non-existent targets
Date: Wed, 10 Dec 2025 01:15:00 -0800 [thread overview]
Message-ID: <20251210091501.55277-1-sj@kernel.org> (raw)
In-Reply-To: <20251210052508.264433-1-lienze@kylinos.cn>
On Wed, 10 Dec 2025 13:25:08 +0800 Enze Li <lienze@kylinos.cn> wrote:
> Currently, DAMON does not proactively clean up invalid monitoring
> targets during its runtime. When some monitored processes exit, DAMON
> continues to make 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
>
> it is only in the damon_get_mm() function that it may finally discover
> the target no longer exists, which wastes CPU resources. A simple idea
> is to check for the existence of monitoring targets within the
> kdamond_need_stop() function and promptly clean up non-existent targets.
>
> However, SJ pointed out that this approach is problematic because the
> online commit logic incorrectly uses list indices to update the
> monitoring state. This can lead to data loss if the target list is
> changed concurrently. Meanwhile, SJ suggests checking for target
> existence at the damon_for_each_target level, and if a target does not
> exist, simply skip it and proceed to the next one.
Thank you for making this patch, Enze!
>
> Suggested-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: Enze Li <lienze@kylinos.cn>
Reviewed-by: SeongJae Park <sj@kernel.org>
Thanks,
SJ
[...]
prev parent reply other threads:[~2025-12-10 9:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-10 5:25 [PATCH] mm/damon/core: fix wasteful CPU calls by skipping non-existent targets Enze Li
2025-12-10 9:15 ` 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=20251210091501.55277-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.