Re: [RFC PATCH v2.1 05/17] mm/damon/core: introduce damon_prep struct

[email protected] Mon, 27 Jul 2026 14:48:42 +0000
Newsgroups dev.linux.lists.damon
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] damon_commit_probes() does not synchronize the newly added 'preps' list, leading to lost preparation actions during context updates.
--

--- Patch [5]: [RFC PATCH v2.1 05/17] mm/damon/core: introduce damon_prep struct ---
commit 560f806438365d13be862eb2266c647b1d981d0b
Author: SJ Park <[email protected]>

mm/damon/core: introduce damon_prep struct

Some DAMON probe filter types require preparatory actions, like setting
the PG_Idle flag at a specific time. This commit introduces a new data
type called damon_prep to specify preparation actions for each probe.
It also adds DAMON_PREP_SET_PGIDLE as the initial prep action.

> 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]
Does this change also require an update to damon_commit_probes() to copy the
new preps list?

Currently, when updating a running context, damon_commit_probes() only copies
the weight and filters from the source probe to the destination probe:

mm/damon/core.c:damon_commit_probes() {
    ...
    damon_for_each_probe_safe(dst_probe, next, dst) {
        src_probe = damon_nth_probe(i++, src);
        if (src_probe) {
            dst_probe->weight = src_probe->weight;
            err = damon_commit_filters(dst_probe, src_probe);
    ...
}

This applies both when synchronizing existing probes and when creating new
ones to match the source context.

Without a corresponding damon_commit_preps() mechanism to synchronize these
lists, it appears any preparation actions configured on a source context could
be silently lost when committed to a running destination context.

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=5