Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: 聂诚 <niecheng1@uniontech.com>
To: "SeongJae Park" <sj@kernel.org>
Cc: "SeongJae Park" <sj@kernel.org>, akpm <akpm@linux-foundation.org>,
	damon <damon@lists.linux.dev>, linux-mm <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	kernel <kernel@uniontech.com>
Subject: Re: [PATCH] mm/damon/core: recalculate intervals tuning deadline on attrs update
Date: Thu, 14 May 2026 23:59:32 +0800	[thread overview]
Message-ID: <tencent_64CD15D154D209516E2E77BE@qq.com> (raw)
In-Reply-To: <20260514144102.120203-1-sj@kernel.org>

[-- Attachment #1: Type: text/plain, Size: 2953 bytes --]

Hi SJ,


You are right.


I rechecked kdamond_fn(), and what I observed is a one-shot earlier
intervals tuning after the online update, rather than a persistent
stale-deadline bug.


So I will drop my previous patch and send a small follow-up comment
patch for this subtle behavior.


Thanks,
Niecheng




------------------&nbsp;Original&nbsp;------------------
From: &nbsp;"SeongJae&nbsp;Park"<sj@kernel.org&gt;;
Date: &nbsp;Thu, May 14, 2026 10:41 PM
To: &nbsp;"niecheng"<niecheng1@uniontech.com&gt;; 
Cc: &nbsp;"SeongJae Park"<sj@kernel.org&gt;; "akpm"<akpm@linux-foundation.org&gt;; "damon"<damon@lists.linux.dev&gt;; "linux-mm"<linux-mm@kvack.org&gt;; "linux-kernel"<linux-kernel@vger.kernel.org&gt;; "kernel"<kernel@uniontech.com&gt;; 
Subject: &nbsp;Re: [PATCH] mm/damon/core: recalculate intervals tuning deadline on attrs update

&nbsp;

Hello Nicheng,

On Thu, 14 May 2026 15:48:46 +0800 niecheng <niecheng1@uniontech.com&gt; wrote:

&gt; damon_set_attrs() refreshes next_aggregation_sis and
&gt; next_ops_update_sis for online monitoring attribute updates, but it
&gt; does not refresh next_intervals_tune_sis.
&gt; 
&gt; Because of that, enabling intervals auto-tuning via an online attrs
&gt; commit can leave next_intervals_tune_sis stale.&nbsp; If a context starts
&gt; with intervals_goal.aggrs == 0 and later updates attrs online to set it
&gt; non-zero, kdamond_fn() can treat the tuning deadline as already expired
&gt; and tune the intervals earlier than intended.
&gt; 
&gt; This has been possible since the intervals auto-tuning feature was
&gt; introduced, because that commit initialized the deadline at kdamond
&gt; start but did not refresh it on later attrs updates.

Good finding, thank you for sharing this!

But, the next_interval_tune_sis will be updated based on the updated
aggregation and sampling intervals, just before the next intervals tuning is
made.

In detail, the code flow of the kdamond_fn() main loop is like below:

- call kdamond_call()
&nbsp; - call damon_set_attrs()
&nbsp;&nbsp;&nbsp; - update aggregation and sampling intervals
- if passed_ample_intervals &gt;= next_intervals_tune_sis:
&nbsp; - update next_intervals_tune_sis with updated aggregation and sampling
&nbsp;&nbsp;&nbsp; intervals
&nbsp; - call kdamond_tune_intervals()

So, the old next_intervals_tune_sis will be used only once.&nbsp; I agree not
everyone will think it is the best behavior.&nbsp; But seems ok to me.&nbsp; I'd like to
keep the current code in favor of less complexity.&nbsp; What do you think?

Nevertheless, apparently the code can better be documented.&nbsp; Maybe it is worthy
to add a comment about this.&nbsp; For example, maybe it is better to add a comment
saying "next_intervals_tune_sis will be updated inside kdamond_fn()" on the
damon_set_attrs().&nbsp; If you'd like to, please feel free to post such a patch.


Thanks,
SJ

[...]

[-- Attachment #2: Type: text/html, Size: 3683 bytes --]

  reply	other threads:[~2026-05-14 16:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14  7:48 [PATCH] mm/damon/core: recalculate intervals tuning deadline on attrs update niecheng
2026-05-14 14:41 ` SeongJae Park
2026-05-14 15:59   ` 聂诚 [this message]
2026-05-14 16:15   ` niecheng
2026-05-14 16:37   ` [PATCH] mm/damon/core: clarify next_intervals_tune_sis update path niecheng
2026-05-14 23:45     ` SeongJae Park
2026-05-15  1:17       ` niecheng

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=tencent_64CD15D154D209516E2E77BE@qq.com \
    --to=niecheng1@uniontech.com \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=kernel@uniontech.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sj@kernel.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