* [RFC PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask
2025-06-09 20:00 [RFC PATCH 0/3] mm/damon: use alloc_migration_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
@ 2025-06-09 20:00 ` SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" SeongJae Park
2 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2025-06-09 20:00 UTC (permalink / raw)
Cc: SeongJae Park, Andrew Morton, Honggyu Kim, Simon Wang, damon,
kernel-team, linux-kernel, linux-mm
DAMOS_MIGRATE_{HOT,COLD} implementation resembles that for
demote_folio_list(). Because those are not only for demotion but
general folio migrations, it makes more sense to behave similarly to
move_pages() system call. Make the behavior more similar to
move_pages(), by using alloc_migration_target() instead of
alloc_migrate_folio(), without fallback nodemask.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/paddr.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 4102a8c5f992..fcab148e6865 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -386,7 +386,6 @@ static unsigned int __damon_pa_migrate_folio_list(
int target_nid)
{
unsigned int nr_succeeded = 0;
- nodemask_t allowed_mask = NODE_MASK_NONE;
struct migration_target_control mtc = {
/*
* Allocate from 'node', or fail quickly and quietly.
@@ -396,7 +395,6 @@ static unsigned int __damon_pa_migrate_folio_list(
.gfp_mask = (GFP_HIGHUSER_MOVABLE & ~__GFP_RECLAIM) |
__GFP_NOWARN | __GFP_NOMEMALLOC | GFP_NOWAIT,
.nid = target_nid,
- .nmask = &allowed_mask
};
if (pgdat->node_id == target_nid || target_nid == NUMA_NO_NODE)
@@ -406,7 +404,7 @@ static unsigned int __damon_pa_migrate_folio_list(
return 0;
/* Migration ignores all cpuset and mempolicy settings */
- migrate_pages(migrate_folios, alloc_migrate_folio, NULL,
+ migrate_pages(migrate_folios, alloc_migration_target, NULL,
(unsigned long)&mtc, MIGRATE_ASYNC, MR_DAMON,
&nr_succeeded);
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio"
2025-06-09 20:00 [RFC PATCH 0/3] mm/damon: use alloc_migration_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
@ 2025-06-09 20:00 ` SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" SeongJae Park
2 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2025-06-09 20:00 UTC (permalink / raw)
Cc: SeongJae Park, Andrew Morton, David Hildenbrand, Honggyu Kim,
Johannes Weiner, Lorenzo Stoakes, Michal Hocko, Qi Zheng,
Shakeel Butt, Simon Wang, kernel-team, linux-kernel, linux-mm
This reverts commit 8f75267d22bdf8e3baf70f2fa7092d8c2f58da71.
Commit 8f75267d22bd ("mm: rename alloc_demote_folio to
alloc_migrate_folio") was to reflect the fact the function is called for
not only demotion, but also general migrations from
DAMOS_MIGRATE_{HOT,COLD}. The previous commit made the DAMOS actions to
not use alloc_migrate_folio(), though. So, demote_folio_list() is the
only caller of alloc_migrate_folio(), and the name could now be rather
confusing. Revert the renaming commit.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/internal.h | 2 +-
mm/vmscan.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index 71eaea2db9b0..b76b5162314a 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1227,7 +1227,7 @@ extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long,
unsigned long, unsigned long);
extern void set_pageblock_order(void);
-struct folio *alloc_migrate_folio(struct folio *src, unsigned long private);
+struct folio *alloc_demote_folio(struct folio *src, unsigned long private);
unsigned long reclaim_pages(struct list_head *folio_list);
unsigned int reclaim_clean_pages_from_list(struct zone *zone,
struct list_head *folio_list);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index a93a1ba9009e..6bebc91cbf2f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1006,7 +1006,7 @@ static void folio_check_dirty_writeback(struct folio *folio,
mapping->a_ops->is_dirty_writeback(folio, dirty, writeback);
}
-struct folio *alloc_migrate_folio(struct folio *src, unsigned long private)
+struct folio *alloc_demote_folio(struct folio *src, unsigned long private)
{
struct folio *dst;
nodemask_t *allowed_mask;
@@ -1069,7 +1069,7 @@ static unsigned int demote_folio_list(struct list_head *demote_folios,
node_get_allowed_targets(pgdat, &allowed_mask);
/* Demotion ignores all cpuset and mempolicy settings */
- migrate_pages(demote_folios, alloc_migrate_folio, NULL,
+ migrate_pages(demote_folios, alloc_demote_folio, NULL,
(unsigned long)&mtc, MIGRATE_ASYNC, MR_DEMOTION,
&nr_succeeded);
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [RFC PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration"
2025-06-09 20:00 [RFC PATCH 0/3] mm/damon: use alloc_migration_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
2025-06-09 20:00 ` [RFC PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" SeongJae Park
@ 2025-06-09 20:00 ` SeongJae Park
2 siblings, 0 replies; 4+ messages in thread
From: SeongJae Park @ 2025-06-09 20:00 UTC (permalink / raw)
Cc: SeongJae Park, Andrew Morton, David Hildenbrand, Honggyu Kim,
Johannes Weiner, Lorenzo Stoakes, Michal Hocko, Qi Zheng,
Shakeel Butt, Simon Wang, kernel-team, linux-kernel, linux-mm
This reverts commit a00ce85af2a1be494d3b0c9457e8e81cdcce2a89.
Commit a00ce85af2a1 ("mm: make alloc_demote_folio externally invokable
for migration") was made to let DAMOS_MIGRATE_{HOT,COLD} call the
function. But a previous commit made DAMOS_MIGRATE_{HOT,COLD} call
alloc_migration_target() instead. Hence there are no more callers of
the function outside of vmscan.c. Revert the commit to make the
function static again.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/internal.h | 1 -
mm/vmscan.c | 3 ++-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/internal.h b/mm/internal.h
index b76b5162314a..12470ee5f05b 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -1227,7 +1227,6 @@ extern unsigned long __must_check vm_mmap_pgoff(struct file *, unsigned long,
unsigned long, unsigned long);
extern void set_pageblock_order(void);
-struct folio *alloc_demote_folio(struct folio *src, unsigned long private);
unsigned long reclaim_pages(struct list_head *folio_list);
unsigned int reclaim_clean_pages_from_list(struct zone *zone,
struct list_head *folio_list);
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 6bebc91cbf2f..620dce753b64 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1006,7 +1006,8 @@ static void folio_check_dirty_writeback(struct folio *folio,
mapping->a_ops->is_dirty_writeback(folio, dirty, writeback);
}
-struct folio *alloc_demote_folio(struct folio *src, unsigned long private)
+static struct folio *alloc_demote_folio(struct folio *src,
+ unsigned long private)
{
struct folio *dst;
nodemask_t *allowed_mask;
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread