Re: [RFC PATCH 02/19] mm/damon/core: embed damon_probe objects in damon_ctx

SeongJae Park
2026-04-28T00:36:06Z

On Mon, 27 Apr 2026 16:18:14 +0300 Gutierrez Asier <gutierrez.asier@huawei-partners.com> wrote:

>
>
> On 4/26/2026 11:52 PM, SeongJae Park wrote:
> > Let damon_probe objects be able to be installed on a given damon_ctx, by
> > adding a linked list header for storing the objects. Add initialization
> > and cleanup of the new field with helper functions, too.
> >
> > Signed-off-by: SeongJae Park <sj@kernel.org>
[...]
> > +static void damon_del_probe(struct damon_probe *p)
> > +{
> > + list_del(&p->list);
> > +}
> > +
> > +static void damon_free_probe(struct damon_probe *p)
> > +{
> > + kfree(p);
> > +}
> > +
> > +static void damon_destroy_probe(struct damon_probe *p)
> > +{
> > + damon_del_probe(p);
> > + damon_free_probe(p);
>
> Why don't we inline list_del and kfree here instead of calling
> damon_del/free_probe?

I want to hide the fact that we are using linked list. This abstraction also
makes it easy to control the calling paths of the data structure manipulation.
Meanwhile, smart enough compilers could inline these if it helps.

Thanks,
SJ …