Re: [RFC PATCH 02/19] mm/damon/core: embed damon_probe objects in damon_ctx
From: Gutierrez Asier
Date: Tue Apr 28 2026 - 09:22:00 EST
On 4/28/2026 3:35 AM, SeongJae Park wrote:
> On Mon, 27 Apr 2026 16:18:14 +0300 Gutierrez Asier <gutierrez.asier@xxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxx>
> [...]
>>> +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.
I see your point. It make sense.
>
> Thanks,
> SJ
>
> [...]
>
--
Asier Gutierrez
Huawei