Re: [PATCH v3] mm/damon/ops-common: putback folios on invalid migrate nid
From: SJ Park
Date: Sun Jul 26 2026 - 12:50:18 EST
On Sun, 26 Jul 2026 09:48:15 +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.
Looks good to me, thank you for catching and fixing this, liyouhong!
Andrew, I think this deserves the hotfix fast track. The bug can cause memory
pressure, and can be reliably reproduced by the user. The user should already
have a sysfs write permission, though. Let me know if you think differently.
This patch is applied to damon/next [1] tree. If this patch is not added to
mm.git in short term (~1 week?), I will ask mm.git maintainer (Andrew Morton)
to pick this. So, no action from your side is needed for now. If it seems I
also forgot doing that or you cannot wait for my action, please feel free to
directly ask that to Andrew.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ