Re: [RFC PATCH v2 0/7] DAMON based 2-tier memory management for CXL memory
From: SeongJae Park <sj@kernel.org>
Date: 2024-03-17 15:32:01
Also in:
damon, linux-mm, lkml
Hi Honggyu, On Sun, 17 Mar 2024 17:36:29 +0900 Honggyu Kim [off-list ref] 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 [off-list ref] wrote:quoted
Hi Honggyu,quoted
quoted
-----Original Message----- From: SeongJae Park <sj@kernel.org> Sent: Tuesday, March 12, 2024 3:33 AM To: Honggyu Kim <redacted> Cc: SeongJae Park <sj@kernel.org>; kernel_team <redacted> 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" [off-list ref] wrote:quoted
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" falseDAMOS 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.quoted
quoted
quoted
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.quoted
quoted
quoted
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.quoted
quoted
quoted
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.quoted
quoted
quoted
quoted
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.quoted
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/ (local) 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