Re: [RFC PATCH v2 02/17] mm/damon/paddr: support PGIDLE_UNSET probe filter type

SJ Park <[email protected]> Sun, 26 Jul 2026 11:42:28 -0700
Newsgroups dev.linux.lists.damon
Message-ID <[email protected]>
On Sun, 26 Jul 2026 17:53:33 +0000 [email protected] wrote:

> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] The newly introduced DAMON_FILTER_TYPE_PGIDLE_UNSET probe filter type is completely inaccessible from userspace because it was omitted from the sysfs string mappings.
> --
> 
> --- Patch [2]: [RFC PATCH v2 02/17] mm/damon/paddr: support PGIDLE_UNSET probe filter type ---
> commit 28cc087ac53ca1eb5ea0ff45e8fd4a6108a12c9f
> Author: SJ Park <[email protected]>
> 
> mm/damon/paddr: support PGIDLE_UNSET probe filter type
> 
> Implement support of DAMON_FILTER_TYPE_PGIDLE_UNSET in the physical
> address space DAMON operations set. It reuses damon_folio_young(),
> which was being used for access monitoring.
> 
> > diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
> > index 5a6a78054784a..199de1463fa06 100644
> > --- a/mm/damon/paddr.c
> > +++ b/mm/damon/paddr.c
> > @@ -132,6 +132,12 @@ static bool damon_pa_filter_match(struct damon_filter *filter,
> >  			matched = filter->memcg_id == mem_cgroup_id(memcg);
> >  		rcu_read_unlock();
> >  		break;
> > +	case DAMON_FILTER_TYPE_PGIDLE_UNSET:
> 
> [Severity: Medium]
> Will this new filter type be inaccessible from userspace?
> 
> The DAMON_FILTER_TYPE_PGIDLE_UNSET filter type appears to be missing from the
> damon_sysfs_filter_type_names array in mm/damon/sysfs.c:
> 
> static const struct damon_sysfs_filter_type_name
> damon_sysfs_filter_type_names[] = {
> 	{
> 		.type = DAMON_FILTER_TYPE_ANON,
> 		.name = "anon",
> 	},
> 	{
> 		.type = DAMON_FILTER_TYPE_MEMCG,
> 		.name = "memcg",
> 	},
> };
> 
> Without adding it here (for example, as "pgidle_unset"), won't userspace
> attempts to configure this filter via sysfs be rejected with -EINVAL,
> effectively making it unusable?

A later patch of this series does that.

> 
> > +		if (!folio)
> > +			matched = false;
> > +		else
> > +			matched = damon_folio_young(folio);
> > +		break;
> >  	default:
> >  		break;
> >  	}
> 
> -- 
> Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=2


Thanks,
SJ