All of lore.kernel.org
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Honggyu Kim <honggyu.kim@sk.com>
Cc: SeongJae Park <sj@kernel.org>,
	damon@lists.linux.dev, linux-mm@kvack.org,
	akpm@linux-foundation.org, apopple@nvidia.com,
	baolin.wang@linux.alibaba.com, dave.jiang@intel.com,
	hyeongtak.ji@sk.com, kernel_team@skhynix.com,
	linmiaohe@huawei.com, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	mathieu.desnoyers@efficios.com, mhiramat@kernel.org,
	rakie.kim@sk.com, rostedt@goodmis.org, surenb@google.com,
	yangx.jy@fujitsu.com, ying.huang@intel.com, ziy@nvidia.com,
	42.hyeyoo@gmail.com
Subject: Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory
Date: Sun, 17 Mar 2024 08:31:44 -0700	[thread overview]
Message-ID: <20240317153144.11931-1-sj@kernel.org> (raw)
In-Reply-To: <20240317083635.2085-1-honggyu.kim@sk.com>

Hi Honggyu,

On Sun, 17 Mar 2024 17:36:29 +0900 Honggyu Kim <honggyu.kim@sk.com> wrote:

> Hi SeongJae,
> 
> Thanks for the confirmation.  I have a few comments on young filter so
> please read the inline comments again.
> 
> On Wed, 12 Mar 2024 08:53:00 -0800 SeongJae Park <sj@kernel.org> wrote:
> > Hi Honggyu,
> > 
> > > > -----Original Message-----
> > > > From: SeongJae Park <sj@kernel.org>
> > > > Sent: Tuesday, March 12, 2024 3:33 AM
> > > > To: Honggyu Kim <honggyu.kim@sk.com>
> > > > Cc: SeongJae Park <sj@kernel.org>; kernel_team <kernel_team@skhynix.com>
> > > > Subject: RE: Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory
> > > >
> > > > Hi Honggyu,
> > > >
> > > > On Mon, 11 Mar 2024 12:51:12 +0000 "honggyu.kim@sk.com" <honggyu.kim@sk.com> wrote:
> > > >
> > > > > Hi SeongJae,
> > > > >
> > > > > I've tested it again and found that "young" filter has to be set
> > > > > differently as follows.
> > > > > - demote action: set "young" filter with "matching" true
> > > > > - promote action: set "young" filter with "matching" false
> > > >
> > > > DAMOS filter is basically for filtering "out" memory regions that matches to
> > > > the condition.  Hence in your setup, young pages are not filtered out from
> > > > demote action target.
> > > 
> > > I thought young filter true means "young pages ARE filtered out" for demotion.
> > 
> > You're correct.
> 
> Ack.
> 
> > > 
> > > > That is, you're demoting pages that "not" young.
> > > 
> > > Your explanation here looks opposite to the previous statement.
> > 
> > Again, you're correct.  My intention was "non-young pages are not ..." but
> > maybe I was out of my mind and mistakenly removed "non-" part.  Sorry for the
> > confusion.
> 
> No problem.  I also think it's quite confusing.
> 
> > > 
> > > > And vice versa, so you're applying promote to non-non-young (young) pages.
> > > 
> > > Yes, I understand "promote non-non-young pages" means "promote young pages".
> > > This might be understood as "young pages are NOT filtered out" for promotion
> > > but it doesn't mean that "old pages are filtered out" instead.
> > > And we just rely hot detection only on DAMOS logics such as access frequency
> > > and age. Am I correct?
> > 
> > You're correct.
> 
> Ack.  But if it doesn't mean that "old pages are filtered out" instead,

It does mean that.  Here, filtering is exclusive.  Hence, "filter-in a type of
pages" means "filter-out pages of other types".  At least that's the intention.
To quote the documentation
(https://docs.kernel.org/mm/damon/design.html#filters),

    Each filter specifies the type of target memory, and whether it should
    exclude the memory of the type (filter-out), or all except the memory of
    the type (filter-in).

> then do we really need this filter for promotion?  If not, maybe should
> we create another "old" filter for promotion?  As of now, the promotion
> is mostly done inaccurately, but the accurate migration is done at
> demotion level.

Is this based on your theory?  Or, a real behavior that you're seeing from your
setup?  If this is a real behavior, I think that should be a bug that need to
be fixed.

> To avoid this issue, I feel we should promotion only "young" pages after
> filtering "old" pages out.
> 
> > > 
> > > > I understand this is somewhat complex, but what we have for now.
> > > 
> > > Thanks for the explanation. I guess you mean my filter setup is correct.
> > > Is it correct?
> > 
> > Again, you're correct.  Your filter setup is what I expected to :)
> 
> Thanks.  I see that it works fine, but I would like to have more
> discussion about "young" filter.  What I think about filter is that if I
> apply "young" filter "true" for demotion, then the action applies only
> for "young" pages, but the current implementation works opposite.
> 
> I understand the function name of internal implementation is
> "damos_pa_filter_out" so the basic action is filtering out, but the
> cgroup filter works in the opposite way for now.

Does memcg filter works in the opposite way?  I don't think so because
__damos_pa_filter_out() sets 'matches' as 'true' only if the the given folio is
contained in the given memcg.  'young' filter also simply sets 'matches' as
'true' only if the given folio is young.

If it works in the opposite way, it's a bug that need to be fixed.  Please let
me know if I'm missing something.

> 
> I would like to hear how you think about this.
> 
> > > 
> > > > > Then, I see that "hot_cold" migrates hot/cold memory correctly.
> > > >
> > > > Thank you so much for sharing this great news!  My tests also show no bad
> > > > signal so far.
> > > >
> > > > >
> > > > > Could you please upload the "damon_folio_mkold" patch to LKML?
> > > > > Then I will rebase our changes based on it and run the redis test again.
> > > >
> > > > I will do that soon.
> > > 
> > > Thanks a lot for sharing the RFC v2 for DAMOS young filter.
> > > https://lore.kernel.org/damon/20240311204545.47097-1-sj@kernel.org/
> > > 
> > > I will rebase our work based on it and share the result.
> > 
> > Cool, looking forward to it!  Hopefully we will make it be merged into the
> > mainline by v6.10!
> 
> I hope so.  Thanks for your help!
> 
> Honggyu


Thanks,
SJ

  reply	other threads:[~2024-03-17 15:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 14:05 [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 1/7] mm/damon: refactor DAMOS_PAGEOUT with migration_mode Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 2/7] mm: make alloc_demote_folio externally invokable for migration Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 3/7] mm/damon: introduce DAMOS_DEMOTE action for demotion Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 4/7] mm/memory-tiers: add next_promotion_node to find promotion target Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 5/7] mm/damon: introduce DAMOS_PROMOTE action for promotion Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 6/7] mm/damon/sysfs-schemes: add target_nid on sysfs-schemes Honggyu Kim
2024-02-26 14:05 ` [PATCH v2 7/7] mm/damon/sysfs-schemes: apply target_nid for promote and demote actions Honggyu Kim
2024-02-27 23:51 ` [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory SeongJae Park
2024-03-07  3:05   ` SeongJae Park
2024-03-08  8:31     ` Honggyu Kim
2024-03-17  8:36     ` Honggyu Kim
2024-03-17 15:31       ` SeongJae Park [this message]
2024-03-17 19:13         ` SeongJae Park
2024-03-18 13:33           ` Honggyu Kim
2024-03-18 13:27         ` Honggyu Kim
2024-03-18 19:07           ` SeongJae Park
2024-03-20  7:07             ` Honggyu Kim
2024-03-20 16:56               ` SeongJae Park
2024-03-22  8:27                 ` Honggyu Kim
2024-03-22 16:39                   ` SeongJae Park
2024-03-22  9:02   ` Honggyu Kim
2024-03-22 16:32     ` SeongJae Park
2024-03-25 12:01       ` Honggyu Kim
2024-03-25 22:53         ` SeongJae Park
2024-03-26 23:03           ` SeongJae Park
2024-04-05 10:13             ` Honggyu Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240317153144.11931-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=apopple@nvidia.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=damon@lists.linux.dev \
    --cc=dave.jiang@intel.com \
    --cc=honggyu.kim@sk.com \
    --cc=hyeongtak.ji@sk.com \
    --cc=kernel_team@skhynix.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rakie.kim@sk.com \
    --cc=rostedt@goodmis.org \
    --cc=surenb@google.com \
    --cc=yangx.jy@fujitsu.com \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.