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

SJ Park <[email protected]> Fri, 24 Jul 2026 07:26:34 -0700
Newsgroups dev.linux.lists.damon,org.kernel.vger.linux-kernel,org.kernel.vger.stable,org.kvack.linux-mm
Message-ID <[email protected]>
'checkpatch.pl --nogit --nogit-fallback' suggests adding below recipients.  I
added them.  Please consider using get_maintainer.pl from next time.

- Joshua Hahn <[email protected]>
- [email protected]
- [email protected]


On Fri, 24 Jul 2026 14:01:34 +0800 [email protected] wrote:

> From: liyouhong <[email protected]>
> 
> 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: <[email protected]>
> Assisted-by: Cursor:grok-4.5
> Signed-off-by: liyouhong <[email protected]>

Reviewed-by: SJ Park <[email protected]>


Thanks,
SJ

[...]