Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory

From: SeongJae Park
Date: Fri Mar 22 2024 - 12:32:35 EST


On Fri, 22 Mar 2024 18:02:23 +0900 Honggyu Kim <honggyu.kim@xxxxxx> wrote:

> Hi SeongJae,
>
> On Tue, 27 Feb 2024 15:51:20 -0800 SeongJae Park <sj@xxxxxxxxxx> wrote:
> > On Mon, 26 Feb 2024 23:05:46 +0900 Honggyu Kim <honggyu.kim@xxxxxx> wrote:
> >
> > > There was an RFC IDEA "DAMOS-based Tiered-Memory Management" previously
> > > posted at [1].
> > >
> > > It says there is no implementation of the demote/promote DAMOS action
> > > are made. This RFC is about its implementation for physical address
> > > space.
> > >
> > >
[...]
> > Thank you for running the tests again with the new version of the patches and
> > sharing the results!
>
> It's a bit late answer, but the result was from the previous evaluation.
> I ran it again with RFC v2, but didn't see much difference so just
> pasted the same result here.

No problem, thank you for clarifying :)

[...]
> > > Honggyu Kim (3):
> > > mm/damon: refactor DAMOS_PAGEOUT with migration_mode
> > > mm: make alloc_demote_folio externally invokable for migration
> > > mm/damon: introduce DAMOS_DEMOTE action for demotion
> > >
> > > Hyeongtak Ji (4):
> > > mm/memory-tiers: add next_promotion_node to find promotion target
> > > mm/damon: introduce DAMOS_PROMOTE action for promotion
> > > mm/damon/sysfs-schemes: add target_nid on sysfs-schemes
> > > mm/damon/sysfs-schemes: apply target_nid for promote and demote
> > > actions
> >
> > Honggyu joined DAMON Beer/Coffee/Tea Chat[1] yesterday, and we discussed about
> > this patchset in high level. Sharing the summary here for open discussion. As
> > also discussed on the first version of this patchset[2], we want to make single
> > action for general page migration with minimum changes, but would like to keep
> > page level access re-check. We also agreed the previously proposed DAMOS
> > filter-based approach could make sense for the purpose.
>
> Thanks very much for the summary. I have been trying to merge promote
> and demote actions into a single migrate action, but I found an issue
> regarding damon_pa_scheme_score. It currently calls damon_cold_score()
> for demote action and damon_hot_score() for promote action, but what
> should we call when we use a single migrate action?

Good point! This is what I didn't think about when suggesting that. Thank you
for letting me know this gap! I think there could be two approach, off the top
of my head.

The first one would be extending the interface so that the user can select the
score function. This would let flexible usage, but I'm bit concerned if this
could make things unnecessarily complex, and would really useful in many
general use case.

The second approach would be letting DAMON infer the intention. In this case,
I think we could know the intention is the demotion if the scheme has a youg
pages exclusion filter. Then, we could use the cold_score(). And vice versa.
To cover a case that there is no filter at all, I think we could have one
assumption. My humble intuition says the new action (migrate) may be used more
for promotion use case. So, in damon_pa_scheme_score(), if the action of the
given scheme is the new one (say, MIGRATE), the function will further check if
the scheme has a filter for excluding young pages. If so, the function will
use cold_score(). Otherwise, the function will use hot_score().

So I'd more prefer the second approach. I think it would be not too late to
consider the first approach after waiting for it turns out more actions have
such ambiguity and need more general interface for explicitly set the score
function.


Thanks,
SJ

[...]