From: SJ Park <sj@kernel.org>
To: dayou5941@163.com
Cc: SJ Park <sj@kernel.org>,
akpm@linux-foundation.org, damon@lists.linux.dev,
Li Youhong <liyouhong@kylinos.cn>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/damon/ops-common: factor out damon_putback_folio_list()
Date: Mon, 17 Aug 2026 06:42:00 -0700 [thread overview]
Message-ID: <20260817134202.75525-1-sj@kernel.org> (raw)
In-Reply-To: <20260817063458.351063-1-dayou5941@163.com>
Hello Li,
'get_maintainer.pl --nogit --nogit-fallback' suggests adding below recipients.
I added them. Please consier using get_maintainer.pl from the next time.
- linux-mm@kvack.org
- linux-kernel@vger.kernel.org
On Mon, 17 Aug 2026 14:34:58 +0800 dayou5941@163.com wrote:
> From: Li Youhong <liyouhong@kylinos.cn>
>
> The putback loop is duplicated in damon_migrate_folio_list() and on the
> invalid-nid path of damon_migrate_pages(). Factor it into a small helper
> for readability. No functional change.
Thank you for this patch.
>
> Signed-off-by: Li Youhong <liyouhong@kylinos.cn>
>
> ---
> Note:
> As previously pointed out by the AI regarding whether removing the local
> variable struct folio *folio in the damon_migrate_folio_list()function
> would introduce build-time issues: no build failure will actually occur.
> This is because struct folio *folio is only used inside the while-loop.
> link: https://lore.kernel.org/all/20260724060707.CE1F81F000E9@smtp.kernel.org/
But, a build on my setup actually fails like below:
$ make O=../linux.out mm/damon/
[...]
CC mm/damon/ops-common.o
mm/damon/ops-common.c: In function ‘damon_migrate_folio_list’:
mm/damon/ops-common.c:357:17: error: ‘folio’ undeclared (first use in this function)
357 | folio = lru_to_folio(folio_list);
| ^~~~~
>
> ---
> mm/damon/ops-common.c | 31 +++++++++++++++----------------
> 1 file changed, 15 insertions(+), 16 deletions(-)
>
> diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> index 0bcad6b1e5b9..5c0c941b7f75 100644
> --- a/mm/damon/ops-common.c
> +++ b/mm/damon/ops-common.c
> @@ -329,12 +329,24 @@ static unsigned int __damon_migrate_folio_list(
> return nr_succeeded;
> }
>
> +static void damon_putback_folio_list(struct list_head *folio_list)
> +{
> + struct folio *folio;
> +
> + while (!list_empty(folio_list)) {
> + folio = lru_to_folio(folio_list);
> + list_del(&folio->lru);
> + node_stat_sub_folio(folio, NR_ISOLATED_ANON +
> + folio_is_file_lru(folio));
> + folio_putback_lru(folio);
> + }
> +}
> +
> static unsigned int damon_migrate_folio_list(struct list_head *folio_list,
> struct pglist_data *pgdat,
> int target_nid)
> {
> unsigned int nr_migrated = 0;
> - struct folio *folio;
Above declaration removal is causing the build failure. Let's keep the
declaration.
Thanks,
SJ
[...]
parent reply other threads:[~2026-08-17 13:42 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <20260817063458.351063-1-dayou5941@163.com>]
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=20260817134202.75525-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=dayou5941@163.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liyouhong@kylinos.cn \
/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