* [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD}
@ 2025-06-16 17:23 SeongJae Park
2025-06-16 17:23 ` [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: SeongJae Park @ 2025-06-16 17:23 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, David Hildenbrand, Honggyu Kim, Johannes Weiner,
Lorenzo Stoakes, Michal Hocko, Qi Zheng, Shakeel Butt, damon,
kernel-team, linux-kernel, linux-mm
DAMOS_MIGRATE_{HOT,COLD} implementation resembles that for demotion, and
hence the behavior is also similar to that. But, since those are not
only for demotion but general migrations, it would be better to match
with that for move_pages() system call. Make the implementation and the
behavior more similar to move_pages() by not setting migration fallback
nodes, and using alloc_migration_target() instead of
alloc_migrate_folio().
alloc_migrate_folio() was renamed from alloc_demote_folio() and been
non-static function, to let DAMOS_MIGRATE_{HOT,COLD} call it. As
alloc_migration_target() is called instead, the renaming and de-static
changes are no more required but could only make future code readers be
confused. Revert the changes, too.
Changes from RFC
(https://lore.kernel.org/20250609200048.50914-1-sj@kernel.org)
- Rebase to latest mm-new
- Slightly wordsmith cv and commit messages
SeongJae Park (3):
mm/damon/paddr: use alloc_migartion_target() with no migration
fallback nodemask
Revert "mm: rename alloc_demote_folio to alloc_migrate_folio"
Revert "mm: make alloc_demote_folio externally invokable for
migration"
mm/damon/paddr.c | 4 +---
mm/internal.h | 1 -
mm/vmscan.c | 5 +++--
3 files changed, 4 insertions(+), 6 deletions(-)
base-commit: b29ac9653c1fae75d3444b6a03521c74adb6d4cc
--
2.39.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask
2025-06-16 17:23 [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
@ 2025-06-16 17:23 ` SeongJae Park
2025-06-16 17:23 ` [PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" SeongJae Park
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2025-06-16 17:23 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, Honggyu Kim, 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] 6+ messages in thread
* [PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio"
2025-06-16 17:23 [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
2025-06-16 17:23 ` [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
@ 2025-06-16 17:23 ` SeongJae Park
2025-06-16 17:23 ` [PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" SeongJae Park
2025-06-16 21:31 ` [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} Joshua Hahn
3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2025-06-16 17:23 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, David Hildenbrand, Honggyu Kim, Johannes Weiner,
Lorenzo Stoakes, Michal Hocko, Qi Zheng, Shakeel Butt, damon,
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 3823fb356d3b..aedcf95737ed 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] 6+ messages in thread
* [PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration"
2025-06-16 17:23 [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
2025-06-16 17:23 ` [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
2025-06-16 17:23 ` [PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" SeongJae Park
@ 2025-06-16 17:23 ` SeongJae Park
2025-06-16 21:31 ` [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} Joshua Hahn
3 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2025-06-16 17:23 UTC (permalink / raw)
To: Andrew Morton
Cc: SeongJae Park, David Hildenbrand, Honggyu Kim, Johannes Weiner,
Lorenzo Stoakes, Michal Hocko, Qi Zheng, Shakeel Butt, damon,
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 aedcf95737ed..746fa4187e9e 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] 6+ messages in thread
* Re: [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD}
2025-06-16 17:23 [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
` (2 preceding siblings ...)
2025-06-16 17:23 ` [PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" SeongJae Park
@ 2025-06-16 21:31 ` Joshua Hahn
2025-06-16 22:48 ` SeongJae Park
3 siblings, 1 reply; 6+ messages in thread
From: Joshua Hahn @ 2025-06-16 21:31 UTC (permalink / raw)
To: SeongJae Park
Cc: Andrew Morton, David Hildenbrand, Honggyu Kim, Johannes Weiner,
Lorenzo Stoakes, Michal Hocko, Qi Zheng, Shakeel Butt, damon,
kernel-team, linux-kernel, linux-mm
On Mon, 16 Jun 2025 10:23:43 -0700 SeongJae Park <sj@kernel.org> wrote:
> DAMOS_MIGRATE_{HOT,COLD} implementation resembles that for demotion, and
> hence the behavior is also similar to that. But, since those are not
> only for demotion but general migrations, it would be better to match
> with that for move_pages() system call. Make the implementation and the
> behavior more similar to move_pages() by not setting migration fallback
> nodes, and using alloc_migration_target() instead of
> alloc_migrate_folio().
>
> alloc_migrate_folio() was renamed from alloc_demote_folio() and been
> non-static function, to let DAMOS_MIGRATE_{HOT,COLD} call it. As
> alloc_migration_target() is called instead, the renaming and de-static
> changes are no more required but could only make future code readers be
> confused. Revert the changes, too.
Hi SJ,
I hope you are doing well!
These changes all look good to me. And I agree that changing the behavior
to mimic migration as opposed to demotion might be helpful in making
opportunities for others to use DAMOS as a means to perform other related
works (like [1]), without having to use a "demotion" mechanism for simply
moving pages around.
I do have one question: I'm curious what kinds of changes callers can expect.
Would I be correct in understanding that this is mostly a semantic change
(aside from no longer having a fallback nodemask)? Just want to make sure I
have a correct understanding of your intent was.
In the meantime, feel free to add the following to the series:
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Have a great day!
Joshua
[1] https://lore.kernel.org/all/20250612181330.31236-1-bijan311@gmail.com/
Sent using hkml (https://github.com/sjp38/hackermail)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD}
2025-06-16 21:31 ` [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} Joshua Hahn
@ 2025-06-16 22:48 ` SeongJae Park
0 siblings, 0 replies; 6+ messages in thread
From: SeongJae Park @ 2025-06-16 22:48 UTC (permalink / raw)
To: Joshua Hahn
Cc: SeongJae Park, Andrew Morton, David Hildenbrand, Honggyu Kim,
Johannes Weiner, Lorenzo Stoakes, Michal Hocko, Qi Zheng,
Shakeel Butt, damon, kernel-team, linux-kernel, linux-mm
Hi Joshua,
On Mon, 16 Jun 2025 14:31:58 -0700 Joshua Hahn <joshua.hahnjy@gmail.com> wrote:
> On Mon, 16 Jun 2025 10:23:43 -0700 SeongJae Park <sj@kernel.org> wrote:
>
> > DAMOS_MIGRATE_{HOT,COLD} implementation resembles that for demotion, and
> > hence the behavior is also similar to that. But, since those are not
> > only for demotion but general migrations, it would be better to match
> > with that for move_pages() system call. Make the implementation and the
> > behavior more similar to move_pages() by not setting migration fallback
> > nodes, and using alloc_migration_target() instead of
> > alloc_migrate_folio().
> >
> > alloc_migrate_folio() was renamed from alloc_demote_folio() and been
> > non-static function, to let DAMOS_MIGRATE_{HOT,COLD} call it. As
> > alloc_migration_target() is called instead, the renaming and de-static
> > changes are no more required but could only make future code readers be
> > confused. Revert the changes, too.
>
> Hi SJ,
> I hope you are doing well!
Thank you, you too! :)
>
> These changes all look good to me. And I agree that changing the behavior
> to mimic migration as opposed to demotion might be helpful in making
> opportunities for others to use DAMOS as a means to perform other related
> works (like [1]), without having to use a "demotion" mechanism for simply
> moving pages around.
>
> I do have one question: I'm curious what kinds of changes callers can expect.
> Would I be correct in understanding that this is mostly a semantic change
> (aside from no longer having a fallback nodemask)? Just want to make sure I
> have a correct understanding of your intent was.
You're correct. This is not changing any DAMON interface, so DAMON API callers
and DAMON ABI users would not need to make any change from their side.
>
> In the meantime, feel free to add the following to the series:
> Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Thank you! :)
>
> Have a great day!
You too!
Thanks,
SJ
[...]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-06-16 22:48 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-16 17:23 [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} SeongJae Park
2025-06-16 17:23 ` [PATCH 1/3] mm/damon/paddr: use alloc_migartion_target() with no migration fallback nodemask SeongJae Park
2025-06-16 17:23 ` [PATCH 2/3] Revert "mm: rename alloc_demote_folio to alloc_migrate_folio" SeongJae Park
2025-06-16 17:23 ` [PATCH 3/3] Revert "mm: make alloc_demote_folio externally invokable for migration" SeongJae Park
2025-06-16 21:31 ` [PATCH 0/3] mm/damon: use alloc_migrate_target() for DAMOS_MIGRATE_{HOT,COLD} Joshua Hahn
2025-06-16 22:48 ` SeongJae Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).