From: SeongJae Park <sj@kernel.org>
Cc: SeongJae Park <sj@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
damon@lists.linux.dev, kernel-team@meta.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [RFC PATCH 04/14] mm/damon/reclaim: use damon_call() repeat mode instead of damon_callback
Date: Sun, 6 Jul 2025 13:00:08 -0700 [thread overview]
Message-ID: <20250706200018.42704-5-sj@kernel.org> (raw)
In-Reply-To: <20250706200018.42704-1-sj@kernel.org>
DAMON_RECLAIM uses damon_callback for periodically reading and writing
DAMON internal data and parameters. Use its alternative, damon_call()
repeat mode.
Signed-off-by: SeongJae Park <sj@kernel.org>
---
mm/damon/reclaim.c | 62 +++++++++++++++++++++++-----------------------
1 file changed, 31 insertions(+), 31 deletions(-)
diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index 0fe8996328b8..3c71b4596676 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -238,6 +238,35 @@ static int damon_reclaim_apply_parameters(void)
return err;
}
+static int damon_reclaim_handle_commit_inputs(void)
+{
+ int err;
+
+ if (!commit_inputs)
+ return 0;
+
+ err = damon_reclaim_apply_parameters();
+ commit_inputs = false;
+ return err;
+}
+
+static int damon_reclaim_damon_call_fn(void *arg)
+{
+ struct damon_ctx *c = arg;
+ struct damos *s;
+
+ /* update the stats parameter */
+ damon_for_each_scheme(s, c)
+ damon_reclaim_stat = s->stat;
+
+ return damon_reclaim_handle_commit_inputs();
+}
+
+static struct damon_call_control call_control = {
+ .fn = damon_reclaim_damon_call_fn,
+ .repeat = true,
+};
+
static int damon_reclaim_turn(bool on)
{
int err;
@@ -257,7 +286,7 @@ static int damon_reclaim_turn(bool on)
if (err)
return err;
kdamond_pid = ctx->kdamond->pid;
- return 0;
+ return damon_call(ctx, &call_control);
}
static int damon_reclaim_enabled_store(const char *val,
@@ -296,34 +325,6 @@ module_param_cb(enabled, &enabled_param_ops, &enabled, 0600);
MODULE_PARM_DESC(enabled,
"Enable or disable DAMON_RECLAIM (default: disabled)");
-static int damon_reclaim_handle_commit_inputs(void)
-{
- int err;
-
- if (!commit_inputs)
- return 0;
-
- err = damon_reclaim_apply_parameters();
- commit_inputs = false;
- return err;
-}
-
-static int damon_reclaim_after_aggregation(struct damon_ctx *c)
-{
- struct damos *s;
-
- /* update the stats parameter */
- damon_for_each_scheme(s, c)
- damon_reclaim_stat = s->stat;
-
- return damon_reclaim_handle_commit_inputs();
-}
-
-static int damon_reclaim_after_wmarks_check(struct damon_ctx *c)
-{
- return damon_reclaim_handle_commit_inputs();
-}
-
static int __init damon_reclaim_init(void)
{
int err = damon_modules_new_paddr_ctx_target(&ctx, &target);
@@ -331,8 +332,7 @@ static int __init damon_reclaim_init(void)
if (err)
goto out;
- ctx->callback.after_wmarks_check = damon_reclaim_after_wmarks_check;
- ctx->callback.after_aggregation = damon_reclaim_after_aggregation;
+ call_control.data = ctx;
/* 'enabled' has set before this function, probably via command line */
if (enabled)
--
2.39.5
next prev parent reply other threads:[~2025-07-06 20:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-06 20:00 [RFC PATCH 00/14] mm/damon: remove damon_callback SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 01/14] mm/damon: accept parallel damon_call() requests SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 02/14] mm/damon/core: introduce repeat mode damon_call() SeongJae Park
2025-07-06 21:45 ` SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 03/14] mm/damon/stat: use damon_call() repeat mode instead of damon_callback SeongJae Park
2025-07-06 20:00 ` SeongJae Park [this message]
2025-07-06 20:00 ` [RFC PATCH 05/14] mm/damon/lru_sort: " SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 06/14] samples/damon/prcl: " SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 07/14] samples/damon/wsse: " SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 08/14] mm/damon/core: do not call ops.cleanup() when destroying targets SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 09/14] mm/damon/core: add cleanup_target() ops callback SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 10/14] mm/damon/vaddr: put pid in cleanup_target() SeongJae Park
2025-07-06 21:48 ` SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 11/14] mm/damon/sysfs: remove damon_sysfs_destroy_targets() SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 12/14] mm/damon/core: destroy targets when kdamond_fn() finish SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 13/14] mm/damon/sysfs: remove damon_sysfs_before_terminate() SeongJae Park
2025-07-06 20:00 ` [RFC PATCH 14/14] mm/damon/core: remove damon_callback SeongJae 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=20250706200018.42704-5-sj@kernel.org \
--to=sj@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=damon@lists.linux.dev \
--cc=kernel-team@meta.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