linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Quanmin Yan <yanquanmin1@huawei.com>
Cc: SeongJae Park <sj@kernel.org>,
	akpm@linux-foundation.org, damon@lists.linux.dev,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	wangkefeng.wang@huawei.com, zuoze1@huawei.com
Subject: Re: [PATCH v2 2/2] mm/damon/sysfs: change next_update_jiffies to a global variable
Date: Thu, 30 Oct 2025 07:32:20 -0700	[thread overview]
Message-ID: <20251030143221.46859-1-sj@kernel.org> (raw)
In-Reply-To: <20251030020746.967174-3-yanquanmin1@huawei.com>

On Thu, 30 Oct 2025 10:07:46 +0800 Quanmin Yan <yanquanmin1@huawei.com> wrote:

> In DAMON’s damon_sysfs_repeat_call_fn(), time_before() is used to compare
> the current jiffies with next_update_jiffies to determine whether to
> update the sysfs files at this moment.
> 
> On 32-bit systems, the kernel initializes jiffies to "-5 minutes" to make
> jiffies wrap bugs appear earlier. However, this causes time_before() in
> damon_sysfs_repeat_call_fn() to unexpectedly return true during the first
> 5 minutes after boot on 32-bit systems (see [1] for more explanation,
> which fixes another jiffies-related issue before). As a result, DAMON
> does not update sysfs files during that period.
> 
> There is also an issue unrelated to the system’s word size[2]: if the
> user stops DAMON just after next_update_jiffies is updated and restarts
> it after 'refresh_ms' or a longer delay, next_update_jiffies will retain
> an older value, causing time_before() to return false and the update to
> happen earlier than expected.
> 
> Fix these issues by making next_update_jiffies a global variable and
> initializing it each time DAMON is started.
> 
> [1] https://lkml.kernel.org/r/20250822025057.1740854-1-ekffu200098@gmail.com
> [2] https://lore.kernel.org/all/20251029013038.66625-1-sj@kernel.org/

Thank you for finding and fixing these!

> 
> Fixes: d809a7c64ba8 ("mm/damon/sysfs: implement refresh_ms file internal work")
> Suggested-by: SeongJae Park <sj@kernel.org>
> Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com>

Reviewed-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]


      reply	other threads:[~2025-10-30 14:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30  2:07 [PATCH v2 0/2] mm/damon: fixes for the jiffies-related issues Quanmin Yan
2025-10-30  2:07 ` [PATCH v2 1/2] mm/damon/stat: change last_refresh_jiffies to a global variable Quanmin Yan
2025-10-30 14:31   ` SeongJae Park
2025-10-30  2:07 ` [PATCH v2 2/2] mm/damon/sysfs: change next_update_jiffies " Quanmin Yan
2025-10-30 14:32   ` SeongJae Park [this message]

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=20251030143221.46859-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wangkefeng.wang@huawei.com \
    --cc=yanquanmin1@huawei.com \
    --cc=zuoze1@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox