From: SJ Park <sj@kernel.org>
To: sashiko-bot@kernel.org
Cc: SJ Park <sj@kernel.org>, damon@lists.linux.dev
Subject: Re: [RFC PATCH v2.2 05/17] mm/damon/core: introduce damon_prep struct
Date: Mon, 27 Jul 2026 21:54:04 -0700 [thread overview]
Message-ID: <20260728045405.189681-1-sj@kernel.org> (raw)
In-Reply-To: <20260728042518.899B61F000E9@smtp.kernel.org>
On Tue, 28 Jul 2026 04:25:18 +0000 sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [Medium] The newly introduced `preps` list in `struct damon_probe` is not synchronized during `damon_commit_probes()`.
> - [Medium] Missing public API to remove or destroy individual `damon_prep` instances dynamically.
> --
>
> --- Patch [5]: [RFC PATCH v2.2 05/17] mm/damon/core: introduce damon_prep struct ---
> commit d7a749334ed0e3303b955b00673d30f87ca5091c
> Author: SJ Park <sj@kernel.org>
>
> mm/damon/core: introduce damon_prep struct
>
> Some DAMON probe filter types require preparatory actions to operate
> effectively, such as setting the PG_Idle flag at a specific time. This
> commit introduces a new data type called damon_prep to specify these
> preparation actions for each probe. DAMON will execute the action for
> each region per sampling interval.
>
> > diff --git a/include/linux/damon.h b/include/linux/damon.h
> > index a8bb9ee6979e3..1a8de735f955b 100644
> > --- a/include/linux/damon.h
> > +++ b/include/linux/damon.h
>
> [ ... ]
>
> > @@ -780,6 +801,8 @@ struct damon_filter {
> > struct damon_probe {
> > unsigned int weight;
> > /* private: */
> > + /* Preparation actions to apply to each probing memory. */
> > + struct list_head preps;
> > /* Filters for assessing if a given region is for this probe. */
> > struct list_head filters;
> > /* Siblings list. */
>
> [Severity: Medium]
> Will this preps list be synchronized when a DAMON context is updated or
> cloned?
>
> Looking at damon_commit_probes() in mm/damon/core.c, it only seems to copy
> the weight and filters from the source probe to the destination probe:
>
> mm/damon/core.c:damon_commit_probes() {
> ...
> if (src_probe) {
> dst_probe->weight = src_probe->weight;
> err = damon_commit_filters(dst_probe, src_probe);
> if (err)
> return err;
> } else {
> damon_destroy_probe(dst_probe);
> }
> ...
> }
>
> It appears there is no logic to copy the new preps list. Could this leave
> the running context's preparation actions out of sync and silently discard
> configurations when damon_commit_ctx() is called?
A later patch of this series does that.
>
> > diff --git a/mm/damon/core.c b/mm/damon/core.c
> > index 644daf5a16560..0b396c2456d05 100644
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
>
> [ ... ]
>
> > @@ -111,6 +111,28 @@ int damon_select_ops(struct damon_ctx *ctx, enum damon_ops_id id)
> > return err;
> > }
> >
> > +struct damon_prep *damon_new_prep(enum damon_prep_action action)
> > +{
> > + struct damon_prep *prep;
> > +
> > + prep = kmalloc_obj(*prep);
> > + if (!prep)
> > + return NULL;
> > + prep->action = action;
> > + INIT_LIST_HEAD(&prep->list);
> > + return prep;
> > +}
> > +
> > +void damon_add_prep(struct damon_probe *p, struct damon_prep *prep)
> > +{
> > + list_add_tail(&prep->list, &p->preps);
> > +}
> > +
> > +static void damon_free_prep(struct damon_prep *p)
> > +{
> > + kfree(p);
> > +}
>
> [Severity: Medium]
> Should there be a public API to remove or destroy individual damon_prep
> instances dynamically?
>
> Since damon_add_prep() is provided to dynamically add preparation actions
> to a probe, it seems there might be a need for a corresponding
> damon_destroy_prep() or damon_del_prep(). Without exporting such functions
> and with damon_free_prep() restricted to static scope, is there a way for
> API consumers to dynamically remove or free a prep without destroying the
> entire probe?
Users will be able to do that via damon_destroy_ctx().
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260728041242.187380-1-sj@kernel.org?part=5
Thanks,
SJ
next prev parent reply other threads:[~2026-07-28 4:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 4:12 [RFC PATCH v2.2 00/17] mm/damon: introduce data access-as-a-data attribute SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 01/17] mm/damon/core: introduce DAMON_FILTER_TYPE_PGIDLE_UNSET SJ Park
2026-07-28 4:23 ` sashiko-bot
2026-07-28 4:49 ` SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 02/17] mm/damon/paddr: support PGIDLE_UNSET probe filter type SJ Park
2026-07-28 4:32 ` sashiko-bot
2026-07-28 4:52 ` SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 03/17] mm/damon/sysfs: support pgidle_unset " SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 04/17] Docs/mm/damon/design: document " SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 05/17] mm/damon/core: introduce damon_prep struct SJ Park
2026-07-28 4:25 ` sashiko-bot
2026-07-28 4:54 ` SJ Park [this message]
2026-07-28 4:12 ` [RFC PATCH v2.2 06/17] mm/damon/core: commit preps SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 07/17] mm/damon/core: introduce damon_operations->prep_probes() SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 08/17] mm/damon/paddr: support damon_prep SJ Park
2026-07-28 4:24 ` sashiko-bot
2026-07-28 4:56 ` SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 09/17] mm/damon/sysfs: implement preps directory SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 10/17] mm/damon/sysfs: implement preps/nr_preps file SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 11/17] mm/damon/sysfs: create directories for nr_preps writes SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 12/17] mm/damon/sysfs: implement prep_action file SJ Park
2026-07-28 4:23 ` sashiko-bot
2026-07-28 4:58 ` SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 13/17] mm/damon/sysfs: pass preps to DAMON core SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 14/17] selftests/damon/sysfs.sh: test probe prep sysfs files SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 15/17] Docs/mm/damon/design: document probe preps SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 16/17] Docs/admin-guide/mm/damon/usage: document probe preps sysfs files SJ Park
2026-07-28 4:12 ` [RFC PATCH v2.2 17/17] Docs/ABI/damon: document probe prep " SJ Park
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=20260728045405.189681-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=damon@lists.linux.dev \
--cc=sashiko-bot@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).