linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] add a knob to control whether to use other nodes at the same tier of the target node in DAMON
@ 2025-05-28 11:10 wangchuanguo
  2025-05-28 11:10 ` [PATCH 1/2] mm: migrate: restore the nmask after successfully allocating on the target node wangchuanguo
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: wangchuanguo @ 2025-05-28 11:10 UTC (permalink / raw)
  To: akpm, hannes, sj
  Cc: david, mhocko, zhengqi.arch, shakeel.butt, lorenzo.stoakes,
	linux-mm, linux-kernel, damon, wangchuanguo

In DAMON's migrate_hot and migrate_cold features, the code was
intended to migrate pages ​​only to the node specified by target_nid​​.
However, during testing, it was observed that memory allocation
and migration could occur on ​​any nodes​​, which is a BUG.
The first patch in this PR fix this issue.

A use_nodes_of_tier file has been added under the directory /sys/kernel/mm/damon/admin/kdamonds/<N>/contexts/<N>/schemes/<N>/
to control whether to ​​use other nodes in the same tier as
the target node​​ for migration.

wangchuanguo (2):
  mm: migrate: restore the nmask after successfully allocating on the 
    target node
  mm/damon/sysfs-schemes: add use_nodes_of_tier on sysfs-schemes

 include/linux/damon.h        |  9 ++++++++-
 include/linux/memory-tiers.h |  5 +++++
 mm/damon/core.c              |  6 ++++--
 mm/damon/lru_sort.c          |  3 ++-
 mm/damon/paddr.c             | 19 ++++++++++++-------
 mm/damon/reclaim.c           |  3 ++-
 mm/damon/sysfs-schemes.c     | 31 ++++++++++++++++++++++++++++++-
 mm/memory-tiers.c            | 13 +++++++++++++
 mm/vmscan.c                  |  2 +-
 samples/damon/mtier.c        |  3 ++-
 samples/damon/prcl.c         |  3 ++-
 11 files changed, 81 insertions(+), 16 deletions(-)

-- 
2.39.3



^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH 2/2] mm/damon/sysfs-schemes: add use_nodes_of_tier on sysfs-schemes
@ 2025-05-29  3:12 Simon Wang (王传国)
  2025-05-29 16:46 ` SeongJae Park
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Wang (王传国) @ 2025-05-29  3:12 UTC (permalink / raw)
  To: SeongJae Park
  Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, david@redhat.com,
	mhocko@kernel.org, zhengqi.arch@bytedance.com,
	shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	damon@lists.linux.dev

> > This patch adds use_nodes_of_tier under
> >
> /sys/kernel/mm/damon/admin/kdamonds/<N>/contexts/<N>/schemes/<N>/
> >
> > The 'use_nodes_of_tier' can be used to select nodes within the same
> > memory tier of target_nid for DAMOS actions such as
> DAMOS_MIGRATE_{HOT,COLD}.
> 
> Could you please elaborate in what setup you think this option is useful, and
> measurement of the usefulness if you have?
> 
> I'm asking the above question because of below reasons.  My anticiapted
> usage of DAMOS_MIGRATE_{HOT,COLD} is for not only memory tiering but
> generic NUMA node management.  And my proposed usage of these for
> memory tiering is making per-node promotion/demotion for gradually
> promoting and demoting pages step by step between node.  It could be slow
> but I anticipate such slow but continued promotion/demotion is more
> important for reliable performance on production systems of large time scale.
> And I believe the approach can be applied to general NUMA nodes
> management, once DAMON is extended for per-CPU access monitoring.
> 
> I'm not saying this change is not useful, but asking you to give me a chance to
> learn your changes, better.

I believe some users may want to ​​use only the target node's memory​​ and reserve other nodes in the same tier for specific applications. Therefore, I added a switch file use_nodes_of_tier. I think it might be better to set the default value of use_nodes_of_tier to true (i.e., allow using fallback nodes). What do you think

> >
> > Signed-off-by: wangchuanguo <wangchuanguo@inspur.com>
> > ---
> >  include/linux/damon.h        |  9 ++++++++-
> >  include/linux/memory-tiers.h |  5 +++++
> >  mm/damon/core.c              |  6 ++++--
> >  mm/damon/lru_sort.c          |  3 ++-
> >  mm/damon/paddr.c             | 19 ++++++++++++-------
> >  mm/damon/reclaim.c           |  3 ++-
> >  mm/damon/sysfs-schemes.c     | 31
> ++++++++++++++++++++++++++++++-
> >  mm/memory-tiers.c            | 13 +++++++++++++
> >  samples/damon/mtier.c        |  3 ++-
> >  samples/damon/prcl.c         |  3 ++-
> >  10 files changed, 80 insertions(+), 15 deletions(-)
> 
> Can we please make this change more separated?  Maybe we can split the
> change for memory-tiers.c, DAMON core layer, and DAMON sysfs interface.
> That will make review much easier.

Yes,I'll split this patch to be 2 patches.


> I'll add more comments for details after above high level discussion is done.
> 
> 
> Thanks,
> SJ
> 
> [...]

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [PATCH 2/2] mm/damon/sysfs-schemes: add use_nodes_of_tier on sysfs-schemes
@ 2025-05-30  8:04 Simon Wang (王传国)
  2025-05-30 19:40 ` SeongJae Park
  0 siblings, 1 reply; 16+ messages in thread
From: Simon Wang (王传国) @ 2025-05-30  8:04 UTC (permalink / raw)
  To: SeongJae Park
  Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, david@redhat.com,
	mhocko@kernel.org, zhengqi.arch@bytedance.com,
	shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	damon@lists.linux.dev


> > > > This patch adds use_nodes_of_tier under
> > > >
> > >
> /sys/kernel/mm/damon/admin/kdamonds/<N>/contexts/<N>/schemes/<N>/
> > > >
> > > > The 'use_nodes_of_tier' can be used to select nodes within the
> > > > same memory tier of target_nid for DAMOS actions such as
> > > DAMOS_MIGRATE_{HOT,COLD}.
> > >
> > > Could you please elaborate in what setup you think this option is
> > > useful, and measurement of the usefulness if you have?
> > >
> > > I'm asking the above question because of below reasons.  My
> > > anticiapted usage of DAMOS_MIGRATE_{HOT,COLD} is for not only memory
> > > tiering but generic NUMA node management.  And my proposed usage of
> > > these for memory tiering is making per-node promotion/demotion for
> > > gradually promoting and demoting pages step by step between node.
> > > It could be slow but I anticipate such slow but continued
> > > promotion/demotion is more important for reliable performance on
> production systems of large time scale.
> > > And I believe the approach can be applied to general NUMA nodes
> > > management, once DAMON is extended for per-CPU access monitoring.
> > >
> > > I'm not saying this change is not useful, but asking you to give me
> > > a chance to learn your changes, better.
> >
> > I believe some users may want to ​​use only the target node's memory​​
> > and reserve other nodes in the same tier for specific applications.
> > Therefore, I added a switch file use_nodes_of_tier.
> 
> Thank you for clarifying, Simon.
> 
> Because this is an ABI change that difficult to revert and therefore we may
> need to support for long term, I'd like to have more clear theory and/or data if
> possible.  In my humble opinion, above clarification doesn't sound like a
> strong enough justification for ABI change.
> 
> More specifically, it would be better if you could answer below questions.
> Who would be such users, how common the use case would be, and what are
> the benefit of doing so?  Is that only theory?  Or, a real existing use case?
> Can you share measurement of the benefit from this change that measured
> from real workloads or benchmarks?  Is there an alternative way to do this
> without ABI change?


Your concern is that adding the bool use_nodes_of_tier variable and introducing 
an additional parameter to multiple functions would cause ABI changes, correct?​​

​​I propose avoiding the creation of the 'use_nodes_of_tier' sysfs file. Instead, 
we can modify the __damon_pa_migrate_folio_list() function to change the allowed_mask 
from NODE_MASK_NONE to the full node mask of the entire tier where the target_nid resides. 
This approach would be similar to the implementation in commit 320080272892
 ('mm/demotion: demote pages according to allocation fallback order').

I'd like to confirm two modification points with you:
​​1.Regarding alloc_migrate_folio()​​:
Restoring the original nodemask and gfp_mask in this function is the correct approach, correct?
​​2.Regarding DAMON's migration logic​​:
The target scope should be expanded from a single specified node to the entire memory tier
 (where the target node resides), correct?
​​Can we confirm these two points are agreed upon?​
 
> > I think it might be better to set the default value of
> > use_nodes_of_tier to true (i.e., allow using fallback nodes). What do
> > you think
> 
> In my humble opinion, we can consider setting it true by default, if we agree
> the benefit of the change is significant.  With only currently given information,
> I cannot easily say if I think this can really be useful.  As asked abovely, more
> clear thoery and/or real data would be helpful.
> 
> >
> > > >
> > > > Signed-off-by: wangchuanguo <wangchuanguo@inspur.com>
> > > > ---
> > > >  include/linux/damon.h        |  9 ++++++++-
> > > >  include/linux/memory-tiers.h |  5 +++++
> > > >  mm/damon/core.c              |  6 ++++--
> > > >  mm/damon/lru_sort.c          |  3 ++-
> > > >  mm/damon/paddr.c             | 19 ++++++++++++-------
> > > >  mm/damon/reclaim.c           |  3 ++-
> > > >  mm/damon/sysfs-schemes.c     | 31
> > > ++++++++++++++++++++++++++++++-
> > > >  mm/memory-tiers.c            | 13 +++++++++++++
> > > >  samples/damon/mtier.c        |  3 ++-
> > > >  samples/damon/prcl.c         |  3 ++-
> > > >  10 files changed, 80 insertions(+), 15 deletions(-)
> > >
> > > Can we please make this change more separated?  Maybe we can split
> > > the change for memory-tiers.c, DAMON core layer, and DAMON sysfs
> interface.
> > > That will make review much easier.
> >
> > Yes,I'll split this patch to be 2 patches.
> 
> Thank you for accepting my suggestion.  But I think it deserves 3 patches,
> each for
> 
> - memory-tiers.c,
> - DAMON core layer, and
> - and DAMON sysfs interface.
> 
> But, let's further discuss on the high level topic (if this change is really
> beneficial enough to make ABI change).
> 
> 
> Thanks,
> SJ
> 
> [...]

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2025-06-09 19:13 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-28 11:10 [PATCH 0/2] add a knob to control whether to use other nodes at the same tier of the target node in DAMON wangchuanguo
2025-05-28 11:10 ` [PATCH 1/2] mm: migrate: restore the nmask after successfully allocating on the target node wangchuanguo
2025-05-28 22:09   ` SeongJae Park
2025-05-28 11:10 ` [PATCH 2/2] mm/damon/sysfs-schemes: add use_nodes_of_tier on sysfs-schemes wangchuanguo
2025-05-28 21:33   ` kernel test robot
2025-05-28 22:31   ` SeongJae Park
2025-06-09 12:30   ` Honggyu Kim
2025-05-28 22:39 ` [PATCH 0/2] add a knob to control whether to use other nodes at the same tier of the target node in DAMON SeongJae Park
  -- strict thread matches above, loose matches on Subject: below --
2025-05-29  3:12 [PATCH 2/2] mm/damon/sysfs-schemes: add use_nodes_of_tier on sysfs-schemes Simon Wang (王传国)
2025-05-29 16:46 ` SeongJae Park
2025-05-30  8:04 Simon Wang (王传国)
2025-05-30 19:40 ` SeongJae Park
2025-06-03  3:05   ` wangchuanguo
2025-06-05 18:20   ` SeongJae Park
2025-06-09 12:39   ` Honggyu Kim
2025-06-09 19:13     ` 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).