Re: [PATCH] mm/damon: skip folios already on the migration target node

From: SJ Park

Date: Wed Oct 28 2026 - 21:02:03 EST


On Thu, 29 Oct 2026 00:05:46 +1100 Aveline Noir <jm5905938@xxxxxxxxx> wrote:

> While measuring DAMOS migration overhead, I found that the target_nid
> path isolates folios already on the target node, then puts them back on
> the LRU without migrating them.
>
> Skip them before isolation in vaddr and paddr, as the vaddr explicit
> destinations path already does.

Nice catch!

>
> Signed-off-by: Aveline Noir <jm5905938@xxxxxxxxx>

Other than below trivial nit,

Reviewed-by: SJ Park <sj@xxxxxxxxxx>

>
> ---
> DAMON KUnit and selftests all passed. In a synthetic same-node fvaddr
> test on a two-node x86-64 KVM guest (8 interleaved runs per kernel),
> guest-kernel cycles fell by about 29%
> with 4 KiB regions and 90% with 16 MiB regions. Median kdamond CPU
> time fell by about 76% with 16 MiB regions, with no clear change
> with 4 KiB regions.

Thank you for sharing the test result. We don't want to add too much test
results in the commit message. But the performance part above is informative
and concise, so I think it deserves to be in the commit message.

> ---
> mm/damon/paddr.c | 2 ++
> mm/damon/vaddr.c | 22 ++++++++++++----------
> 2 files changed, 14 insertions(+), 10 deletions(-)
[...]
> @@ -858,8 +860,8 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
> goto huge_out;
> if (damos_va_filter_out(s, folio, walk->vma, addr, NULL, pmd))
> goto huge_out;
> - damos_va_migrate_dests_add(folio, walk->vma, addr, dests,
> - migration_lists);
> + damos_va_migrate_dests_add(folio, walk->vma, addr, s,
> + migration_lists);

Let's not align parameters on parentheses but just give two tabs indentation.

> huge_out:
> spin_unlock(ptl);
> return 0;
> @@ -883,8 +885,8 @@ static int damos_va_migrate_pmd_entry(pmd_t *pmd, unsigned long addr,
> continue;
> if (damos_va_filter_out(s, folio, walk->vma, addr, pte, NULL))
> continue;
> - damos_va_migrate_dests_add(folio, walk->vma, addr, dests,
> - migration_lists);
> + damos_va_migrate_dests_add(folio, walk->vma, addr, s,
> + migration_lists);

Ditto.

Assuming you accept my humble suggestions above, I applied this patch to
damon/next [1] tree, together with my above suggestions. I will repost it for
mm.git inclusion within a week. So, no action from your side is needed for
now. Let me know if you think changes to the plan or discussions are needed.

[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees


Thanks,
SJ

[...]