DAMON development mailing list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: dayou5941@163.com
Cc: damon@lists.linux.dev
Subject: Re: [PATCH] mm/damon/ops-common: factor out damon_putback_folio_list()
Date: Mon, 17 Aug 2026 06:41:16 +0000	[thread overview]
Message-ID: <20260817064117.3581D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260817063458.351063-1-dayou5941@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Removal of `struct folio *folio;` declaration causes a compilation failure in `damon_migrate_folio_list()`.
--

--- Patch [1]: [PATCH] mm/damon/ops-common: factor out damon_putback_folio_list() ---
commit b95b21fa4d0d8990d47609474f8cee2aa7d640e1
Author: Li Youhong <liyouhong@kylinos.cn>

mm/damon/ops-common: factor out damon_putback_folio_list()

This commit factors out the duplicated putback loop in
damon_migrate_folio_list() and damon_migrate_pages() into a new
damon_putback_folio_list() helper. The commit notes state this removes
the need for the local folio variable.

Link: https://lore.kernel.org/all/20260724060707.CE1F81F000E9@smtp.kernel.org/

> diff --git a/mm/damon/ops-common.c b/mm/damon/ops-common.c
> index fbda70d8ea4d0..f9cfd35bee722 100644
> --- a/mm/damon/ops-common.c
> +++ b/mm/damon/ops-common.c
[ ... ]
>  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;
>  	LIST_HEAD(ret_folios);
>  	LIST_HEAD(migrate_folios);

[Severity: Low]
The commit message notes that removing the folio variable here won't cause
a build failure. However, does damon_migrate_folio_list() still use the
folio variable in its first while-loop?

Looking at the remaining code in damon_migrate_folio_list():

	while (!list_empty(folio_list)) {
		cond_resched();

		folio = lru_to_folio(folio_list);
		list_del(&folio->lru);

		if (!folio_trylock(folio))
			goto keep;

Will this cause an undeclared identifier compilation error since the variable
was removed from the function scope but not re-declared locally inside this
loop block?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817063458.351063-1-dayou5941@163.com?part=1

  reply	other threads:[~2026-08-17  6:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17  6:34 [PATCH] mm/damon/ops-common: factor out damon_putback_folio_list() dayou5941
2026-08-17  6:41 ` sashiko-bot [this message]
2026-08-17  7:14   ` 李佑鸿 
2026-08-17 13:42 ` SJ Park

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=20260817064117.3581D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=damon@lists.linux.dev \
    --cc=dayou5941@163.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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