[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20260116050737.21407-1-rgbi3307@gmail.com>
Date: Fri, 16 Jan 2026 14:07:35 +0900
From: JaeJoon Jung <rgbi3307@...il.com>
To: sj@...nel.org
Cc: JaeJoon Jung <rgbi3307@...il.com>,
damon@...ts.linux.dev,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
rgbi3307@...e.com
Subject: [PATCH] mm/damon/core: reinitialize when passed_sample_intervals occurred overflow
To concisely explain the variables that calculate the time flow in
kdamond_fn(), we write them as follows:
unsigned long ctx->passed_sample_intervals: c.psi
unsigned long ctx->next_ops_update_sis: c.nui
Normal:
[-----------------+---------------+-------------------+----------]
c.psi c.nui
---------------> next c.nui
if (c.psi >= c.nui) ---------->
Overflow(OF):
[-----------------+---------------+-------------------+----------]
c.psi c.nui
-------------------->
if (c.psi >= c.nui) ---> OF
[-----+-----------
next c.nui
Overflow(OF) occurred if (c.psi >= next c.nui):
Overflow may occur as shown above. In this case, re-run kdamond_init_ctx()
to reinitialize the relevant variables.
Signed-off-by: JaeJoon Jung <rgbi3307@...il.com>
---
mm/damon/core.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index f9fc0375890a..c4b2831cff89 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2740,6 +2740,11 @@ static int kdamond_fn(void *data)
if (ctx->ops.update)
ctx->ops.update(ctx);
sz_limit = damon_region_sz_limit(ctx);
+
+ /* reinitialize when overflow occurs */
+ if (ctx->passed_sample_intervals >=
+ ctx->next_ops_update_sis)
+ kdamond_init_ctx(ctx);
}
}
done:
--
2.43.0
Powered by blists - more mailing lists