From: "Yajun Deng" <yajun.deng@linux.dev>
To: "SeongJae Park" <sj@kernel.org>
Cc: akpm@linux-foundation.org, sieberf@amazon.com,
shakeelb@google.com, foersleo@amazon.de, damon@lists.linux.dev,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon: fix missing damon_del_region()
Date: Wed, 14 Sep 2022 10:26:38 +0000 [thread overview]
Message-ID: <78c7cd3900e0a33da514be8799b35f9f@linux.dev> (raw)
In-Reply-To: <20220914095206.70459-1-sj@kernel.org>
September 14, 2022 5:52 PM, "SeongJae Park" <sj@kernel.org> wrote:
> Hi Yajun,
>
> On Wed, 14 Sep 2022 17:36:36 +0800 Yajun Deng <yajun.deng@linux.dev> wrote:
>
>> It should be called damon_del_region() before free each region, so use
>> damon_destroy_region() instead of damon_free_region().
>
> What 'damon_del_region()' does is deleting the region from target's regions
> linked list so that nobody references it later after its freed. However, as
> each region is linked to one target, and as we will free the target here, the
> list will also be freed. Therefore, we don't need to worry about future
> references to the region.
>
> Anything I'm missing?
>
OK, got it.
> Thanks,
> SJ
>
>> Fixes: f23b8eee1871 (mm/damon/core: implement region-based sampling)
>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
>> ---
>> mm/damon/core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/damon/core.c b/mm/damon/core.c
>> index 0b1eb945c68a..e62e7ebf4b12 100644
>> --- a/mm/damon/core.c
>> +++ b/mm/damon/core.c
>> @@ -361,7 +361,7 @@ void damon_free_target(struct damon_target *t)
>> struct damon_region *r, *next;
>>
>> damon_for_each_region_safe(r, next, t)
>> - damon_free_region(r);
>> + damon_destroy_region(r, t);
>> kfree(t);
>> }
>>
>> --
>> 2.25.1
prev parent reply other threads:[~2022-09-14 10:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-14 9:36 Yajun Deng
2022-09-14 9:52 ` SeongJae Park
2022-09-14 10:26 ` Yajun Deng [this message]
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=78c7cd3900e0a33da514be8799b35f9f@linux.dev \
--to=yajun.deng@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=foersleo@amazon.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=sieberf@amazon.com \
--cc=sj@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