Re: [PATCH v2 1/2] mm/damon/ops-common: putback folios on invalid migrate nid

From: SJ Park

Date: Fri Jul 24 2026 - 10:33:08 EST



'checkpatch.pl --nogit --nogit-fallback' suggests adding below recipients. I
added them. Please consider using get_maintainer.pl from next time.

- Joshua Hahn <joshua.hahnjy@xxxxxxxxx>
- linux-mm@xxxxxxxxx
- linux-kernel@xxxxxxxxxxxxxxx


On Fri, 24 Jul 2026 14:01:34 +0800 dayou5941@xxxxxxx wrote:

> From: liyouhong <liyouhong@xxxxxxxxxx>
>
> damon_pa_migrate() and damos_va_migrate() isolate folios into a local list
> and then call damon_migrate_pages(). When target_nid is invalid (including
> the scheme default NUMA_NO_NODE / -1), damon_migrate_pages() returns early
> without putting the folios back to the LRU.
>
> Callers then discard the list head while those folios remain isolated with
> an extra reference taken by folio_isolate_lru(). The pages stay off the
> LRU for as long as the mapping exists (anon active+inactive counts drop
> while RSS does not), and the leftover references can pin the pages after
> the mapping is gone.
>
> Put the folios back on the invalid-nid path so ignored migration requests
> still return them to the LRU.

Thank you for finding and fixing this!

>
> Fixes: 7e6c3130690a ("mm/damon/ops-common: ignore migration request to invalid nodes")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Assisted-by: Cursor:grok-4.5
> Signed-off-by: liyouhong <liyouhong@xxxxxxxxxx>

Reviewed-by: SJ Park <sj@xxxxxxxxxx>


Thanks,
SJ

[...]