Skip to contentSkip to conversation

mm/damon/core: handle damon_call_control as normal under kdmond deactivation

PATCH Applied SeongJae Park 1 participant 1 message Jun 29, 2025

Subsystems (3)
lore
Share & tools
lore

SeongJae Park

author maintainer
#0 lore raw

PATCH 1/1 mm/damon/core: handle damon_call_control as normal under kdmond deactivation

DAMON sysfs interface internally uses damon_call() to update DAMON parameters as users requested, online. However, DAMON core cancels any damon_call() requests when it is deactivated by DAMOS watermarks.

As a result, users cannot change DAMON parameters online while DAMON is deactivated. Note that users can turn DAMON off and on with different watermarks to work around. Since deactivated DAMON is nearly same to stopped DAMON, the work around should have no big problem. Anyway, a bug is a bug.

There is no real good reason to cancel the damon_call() request under DAMOS deactivation. Fix it by simply handling the request as normal, rather than cancelling under the situation.

Fixes 42b7491af14c ("mm/damon/core: introduce damon_call()")
Cc [email protected] # 6.14.x
---
 mm/damon/core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
mm/damon/core.c +3 -4
index b217e0120e09..bc2e58c1222d 100644
@@ -2355,9 +2355,8 @@ static void kdamond_usleep(unsigned long usecs)
  *
  * If there is a &struct damon_call_control request that registered via
  * &damon_call() on @ctx, do or cancel the invocation of the function depending
- * on @cancel.  @cancel is set when the kdamond is deactivated by DAMOS
- * watermarks, or the kdamond is already out of the main loop and therefore
- * will be terminated.
+ * on @cancel.  @cancel is set when the kdamond is already out of the main loop
+ * and therefore will be terminated.
  */
 static void kdamond_call(struct damon_ctx *ctx, bool cancel)
 {
@@ -2405,7 +2404,7 @@ static int kdamond_wait_activation(struct damon_ctx *ctx)
 		if (ctx->callback.after_wmarks_check &&
 				ctx->callback.after_wmarks_check(ctx))
 			break;
-		kdamond_call(ctx, true);
+		kdamond_call(ctx, false);
 		damos_walk_cancel(ctx);
 	}
 	return -EBUSY;

base-commit: 8f6082b6e60e05f9bcd5c39b19ede995a8975283

Signature · 1 line
2.39.5