From: SJ Park <sj@kernel.org>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: SJ Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Lian Wang <lianux.mm@gmail.com>,
Kunwu Chan <kunwu.chan@gmail.com>,
damon@lists.linux.dev, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] mm/damon/core: score an unmeasured PSI goal as not achieved for the temporal tuner
Date: Tue, 15 Sep 2026 07:50:54 -0700 [thread overview]
Message-ID: <20260915145054.92001-1-sj@kernel.org> (raw)
In-Reply-To: <20260915060937.3423-2-kmehltretter@gmail.com>
Hello Karl,
On Tue, 15 Sep 2026 08:09:36 +0200 Karl Mehltretter <kmehltretter@gmail.com> wrote:
> A newly created or committed PSI quota goal has no previous sample.
> Commit a68878f83ae6 ("mm/damon/core: handle uninitialized
> damos_quota_goal->last_psi_total") scores the first tuning round as
> achieved to preserve the consist tuner's quota, since the feedback
> loop returns its input unchanged at that score.
>
> The temporal tuner sets the quota to zero for an achieved goal. This
> skips the first charge window and the window after each goal commit.
> Committing the PSI goal before every tuning round keeps the scheme
> idle indefinitely.
>
> Score an unmeasured PSI goal as not achieved for the temporal tuner,
> so a new scheme can run in its first window. Keep the consist tuner's
> behaviour unchanged.
Good catch, thank you.
>
> Fixes: a68878f83ae6 ("mm/damon/core: handle uninitialized damos_quota_goal->last_psi_total")
> Cc: <stable@vger.kernel.org> # 7.1.x
> Assisted-by: LLM
> Signed-off-by: Karl Mehltretter <kmehltretter@gmail.com>
> ---
> mm/damon/core.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/mm/damon/core.c b/mm/damon/core.c
> index 06cf2ab7e97d..e6d87fd3992e 100644
> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -3161,12 +3161,18 @@ static void damos_set_quota_goal_current_value(struct damon_ctx *c,
> break;
> case DAMOS_QUOTA_SOME_MEM_PSI_US:
> now_psi_total = damos_get_some_mem_psi_total();
> - /* uninitialized last_psi_total; make no effect this round */
> - if (goal->last_psi_total == U64_MAX)
> - goal->current_value = goal->target_value;
> - else
> + if (goal->last_psi_total == U64_MAX) {
> + /* uninitialized last_psi_total; make no effect this round */
> + if (s->quota.goal_tuner ==
> + DAMOS_QUOTA_GOAL_TUNER_TEMPORAL)
> + /* an achieved score would zero the temporal quota */
> + goal->current_value = 0;
> + else
> + goal->current_value = goal->target_value;
> + } else {
The intention is to make no effect this round. Setting current_value to zero
to temporal tuner means it will now have highest quota it could have. If the
effective quota before this was zero, it gets an effect.
Ideally, we should somehow remember what was the last esz and keep it. I have
no good idea for doing that with minimum change. This is a corner case in my
opinion (correct me if I'm wrong) so I want to keep the change as simple as
possible.
If there is not easy way to do that, I think just keeping the behavior but
making it explicitly explained might be better.
What do you think, Karl?
Thanks,
SJ
[...]
next prev parent reply other threads:[~2026-09-15 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 6:09 [PATCH 0/2] mm/damon: fix zero quota for PSI goals under " Karl Mehltretter
2026-09-15 6:09 ` [PATCH 1/2] mm/damon/core: score an unmeasured PSI goal as not achieved for " Karl Mehltretter
2026-09-15 14:50 ` SJ Park [this message]
2026-09-15 21:19 ` Karl Mehltretter
2026-09-16 0:13 ` SJ Park
2026-09-15 6:09 ` [PATCH 2/2] mm/damon/tests/core-kunit: test PSI goal rounds under " Karl Mehltretter
2026-09-15 7:04 ` KunWu Chan
2026-09-15 21:31 ` Karl Mehltretter
2026-09-16 0:21 ` SJ Park
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=20260915145054.92001-1-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kmehltretter@gmail.com \
--cc=kunwu.chan@gmail.com \
--cc=lianux.mm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®