FAILED: patch "[PATCH] mm/damon: adjust isolated pages stat for" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 1ec0e6b6f7321feb769f50d2f094a0aa6c2eda63
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026081758-bagged-engaged-79ec@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 1ec0e6b6f7321feb769f50d2f094a0aa6c2eda63 Mon Sep 17 00:00:00 2001
From: SJ Park <[email protected]>
Date: Tue, 28 Jul 2026 07:04:03 -0700
Subject: [PATCH] mm/damon: adjust isolated pages stat for
DAMOS_MIGRATE_{HOT,COLD}
Callers of migrate_pages() should adjust NR_MIGRATED_{ANON,FILE} for isolations and putback of the folios. That for migration succeeded folios is done by migrate_pages(), in migrate_folio_done(). That for MR_DEMOTION reason is an exception though.
DAMOS_MIGRATE_{HOT,COLD} call migrate_pages() but mistakenly not doing the stat adjustment. As a result, use of DAMOS_MIGRATE_{HOT,COLD} could corrupt the stat. It could confuse too_many_isolated(), make compaction and reclaim to behave in unexpected ways. The stat corruption can be reproduced and confirmed using DAMON user-space tool [1] on NUMA systems, like below.
$ numactl --hardware
available: 2 nodes (0-1)
[...]
$ sudo ./damo start --damos_action migrate_hot 1
$ sudo cat /proc/sys/vm/stat_refresh
$ sudo dmesg
[...]
[ 80.215554] vmstat_refresh: nr_isolated_anon -5578
[ 80.216842] vmstat_refresh: nr_isolated_file -34400This issue was discovered [2] by Sashiko.
mm/damon/ops-common.c +4 -0
@@ -375,6 +375,8 @@ static unsigned int damon_migrate_folio_list(struct list_head *folio_list,while (!list_empty (folio_list)) { folio =lru_to_folio (folio_list);list_del (&folio->lru); +node_stat_sub_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));folio_putback_lru (folio); }
@@ -397,6 +399,8 @@ unsigned long damon_migrate_pages(struct list_head *folio_list, int target_nid)struct folio *folio =lru_to_folio (folio_list);list_del (&folio->lru); +node_stat_sub_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));folio_putback_lru (folio); }return nr_migrated;
mm/damon/paddr.c +2 -0
@@ -350,6 +350,8 @@ static unsigned long damon_pa_migrate(struct damon_region *r,if (!folio_isolate_lru (folio)) goto put_folio; +node_stat_add_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));list_add (&folio->lru, &folio_list); put_folio: addr +=folio_size (folio);
mm/damon/vaddr.c +2 -1
@@ -649,7 +649,8 @@ static void damos_va_migrate_dests_add(struct folio *folio, isolate:if (!folio_isolate_lru (folio))return ; - +node_stat_add_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));list_add (&folio->lru, &migration_lists[i]); }
SJ Park
maintainerPATCH 1/1 mm/damon: adjust isolated pages stat for DAMOS_MIGRATE_{HOT,COLD}
Callers of migrate_pages() should adjust NR_MIGRATED_{ANON,FILE} for isolations and putback of the folios. That for migration succeeded folios is done by migrate_pages(), in migrate_folio_done(). That for MR_DEMOTION reason is an exception though.
DAMOS_MIGRATE_{HOT,COLD} call migrate_pages() but mistakenly not doing the stat adjustment. As a result, use of DAMOS_MIGRATE_{HOT,COLD} could corrupt the stat. It could confuse too_many_isolated(), make compaction and reclaim to behave in unexpected ways. The stat corruption can be reproduced and confirmed using DAMON user-space tool [1] on NUMA systems, like below.
$ numactl --hardware
available: 2 nodes (0-1)
[...]
$ sudo ./damo start --damos_action migrate_hot 1
$ sudo cat /proc/sys/vm/stat_refresh
$ sudo dmesg
[...]
[ 80.215554] vmstat_refresh: nr_isolated_anon -5578
[ 80.216842] vmstat_refresh: nr_isolated_file -34400This issue was discovered [2] by Sashiko.
---
NOTE: This patch should be applied after the manual backport [1] of 5deb65c34e68 ("mm/damon/ops-common: putback folios on invalid migrate nid").
[1] https://lore.kernel.org/[email protected]
mm/damon/paddr.c | 6 ++++++ 1 file changed, 6 insertions(+)
mm/damon/paddr.c +6 -0
@@ -414,6 +414,8 @@ static unsigned int damon_pa_migrate_folio_list(struct list_head *folio_list,while (!list_empty (folio_list)) { folio =lru_to_folio (folio_list);list_del (&folio->lru); +node_stat_sub_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));folio_putback_lru (folio); }
@@ -437,6 +439,8 @@ static unsigned long damon_pa_migrate_pages(struct list_head *folio_list,struct folio *folio =lru_to_folio (folio_list);list_del (&folio->lru); +node_stat_sub_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));folio_putback_lru (folio); }return nr_migrated;
@@ -487,6 +491,8 @@ static unsigned long damon_pa_migrate(struct damon_region *r, struct damos *s)if (!folio_isolate_lru (folio)) goto put_folio; +node_stat_add_folio (folio,NR_ISOLATED_ANON + +folio_is_file_lru (folio));list_add (&folio->lru, &folio_list); put_folio: addr +=folio_size (folio);
Signature · 1 line
2.47.3
Re: [PATCH 6.12.y] mm/damon: adjust isolated pages stat for DAMOS_MIGRATE_{HOT,COLD}
Quoted 1 line · SJ Park
[PATCH 6.12.y] mm/damon: adjust isolated pages stat for DAMOS_MIGRATE_{HOT,COLD}
Queued for 6.12, thanks - it went in after the ops-common backport, as your note asked.
Signature · 2 lines
Thanks, Sasha