[RFC PATCH 13/14] mm/damon/sysfs: remove damon_sysfs_before_terminate()

From: SeongJae Park
Date: Sun Jul 06 2025 - 16:02:41 EST


DAMON core layer does target cleanup on its own. Remove duplicated and
unnecessarily selective cleanup attempts in DAMON sysfs interface.

Signed-off-by: SeongJae Park <sj@xxxxxxxxxx>
---
mm/damon/sysfs.c | 12 ------------
1 file changed, 12 deletions(-)

diff --git a/mm/damon/sysfs.c b/mm/damon/sysfs.c
index b0f7c60d655a..cce2c8a296e2 100644
--- a/mm/damon/sysfs.c
+++ b/mm/damon/sysfs.c
@@ -1361,17 +1361,6 @@ static int damon_sysfs_add_targets(struct damon_ctx *ctx,
return 0;
}

-static void damon_sysfs_before_terminate(struct damon_ctx *ctx)
-{
- struct damon_target *t, *next;
-
- if (!damon_target_has_pid(ctx))
- return;
-
- damon_for_each_target_safe(t, next, ctx)
- damon_destroy_target(t, ctx);
-}
-
/*
* damon_sysfs_upd_schemes_stats() - Update schemes stats sysfs files.
* @data: The kobject wrapper that associated to the kdamond thread.
@@ -1516,7 +1505,6 @@ static struct damon_ctx *damon_sysfs_build_ctx(
return ERR_PTR(err);
}

- ctx->callback.before_terminate = damon_sysfs_before_terminate;
return ctx;
}

--
2.39.5