mm/damon/core: remove unused helper functions
Subsystems (2)
cover mm/damon/core: remove unused helper functions
Both damon_targets_empty() and damon_nr_running_ctxs() have had no in-tree users since commit 5ec4333b1967 ("mm/damon: remove DAMON debugfs interface") removed their remaining callers.
Remove the unused declarations and definitions.
Tested with:
make O=../linux-build-mm W=1 mm/damon
Cheng-Han Wu (2):
mm/damon/core: remove unused damon_targets_empty() mm/damon/core: remove unused damon_nr_running_ctxs()
include/linux/damon.h | 2 -- mm/damon/core.c | 19 ------------------- 2 files changed, 21 deletions(-)
base-commit: 5e0603ba185af6754422ad28b646798686b6caf6
Signature · 1 line
2.52.0
PATCH 1/2 mm/damon/core: remove unused damon_targets_empty()
damon_targets_empty() has had no in-tree users since commit 5ec4333b1967 ("mm/damon: remove DAMON debugfs interface") removed its last caller.
Remove the unused declaration and definition.
--- include/linux/damon.h | 1 - mm/damon/core.c | 5 ----- 2 files changed, 6 deletions(-)
include/linux/damon.h +0 -1
@@ -1054,7 +1054,6 @@ int damos_commit_quota_goals(struct damos_quota *dst, struct damos_quota *src);struct damon_target *damon_new_target (void );void damon_add_target (struct damon_ctx *ctx,struct damon_target *t); -bool damon_targets_empty (struct damon_ctx *ctx);void damon_free_target (struct damon_target *t);void damon_destroy_target (struct damon_target *t,struct damon_ctx *ctx);unsigned int damon_nr_regions (struct damon_target *t);
mm/damon/core.c +0 -5
@@ -795,11 +795,6 @@ void damon_add_target(struct damon_ctx *ctx, struct damon_target *t)list_add_tail (&t->list, &ctx->adaptive_targets); } -bool damon_targets_empty (struct damon_ctx *ctx) -{ -return list_empty (&ctx->adaptive_targets); -} -static void damon_del_target (struct damon_target *t) {list_del (&t->list);
Signature · 1 line
2.52.0
Re: [PATCH 1/2] mm/damon/core: remove unused damon_targets_empty()
Quoted 5 lines · On Wed, 22 Jul 2026 19:33:37 +0800 Cheng-Han Wu <[email protected]> wrote:
damon_targets_empty()has had no in-tree users since commit5ec4333b1967("mm/damon: remove DAMON debugfs interface") removed its last caller.Remove the unused declaration and definition.
Nice catch and cleanup, thank you!
Quoted 2 lines
Signed-off-by Cheng-Han Wu <[email protected]>
Thanks,
SJ
[...]
PATCH 2/2 mm/damon/core: remove unused damon_nr_running_ctxs()
In reply to Cheng-Han Wudamon_nr_running_ctxs() has had no in-tree users since commit 5ec4333b1967 ("mm/damon: remove DAMON debugfs interface") removed all of its callers.
Remove the unused declaration and definition.
--- include/linux/damon.h | 1 - mm/damon/core.c | 14 -------------- 2 files changed, 15 deletions(-)
include/linux/damon.h +0 -1
@@ -1064,7 +1064,6 @@ int damon_set_attrs(struct damon_ctx *ctx, struct damon_attrs *attrs);void damon_set_schemes (struct damon_ctx *ctx,struct damos **schemes,ssize_t nr_schemes);int damon_commit_ctx (struct damon_ctx *old_ctx,struct damon_ctx *new_ctx); -int damon_nr_running_ctxs (void );bool damon_is_registered_ops (enum damon_ops_id id);int damon_register_ops (struct damon_operations *ops);int damon_select_ops (struct damon_ctx *ctx,enum damon_ops_id id);
mm/damon/core.c +0 -14
@@ -1847,20 +1847,6 @@ int damon_commit_ctx(struct damon_ctx *dst, struct damon_ctx *src)return err; } -/** -* damon_nr_running_ctxs() - Return number of currently running contexts. -*/ -int damon_nr_running_ctxs (void ) -{ -int nr_ctxs; - -mutex_lock (&damon_lock); - nr_ctxs = nr_running_ctxs; -mutex_unlock (&damon_lock); - -return nr_ctxs; -} -/* Returns the size upper limit for each monitoring region */ static unsigned long damon_region_sz_limit (struct damon_ctx *ctx) {
Signature · 1 line
2.52.0
Re: [PATCH 2/2] mm/damon/core: remove unused damon_nr_running_ctxs()
Quoted 5 lines · On Wed, 22 Jul 2026 19:33:38 +0800 Cheng-Han Wu <[email protected]> wrote:
damon_nr_running_ctxs()has had no in-tree users since commit5ec4333b1967("mm/damon: remove DAMON debugfs interface") removed all of its callers.Remove the unused declaration and definition.
Nice catch and cleanup, thank you!
Quoted 2 lines
Signed-off-by Cheng-Han Wu <[email protected]>
Thanks,
SJ
[...]
SJ Park
maintainerQuoted 8 lines · On Wed, 22 Jul 2026 19:33:36 +0800 Cheng-Han Wu <[email protected]> wrote:
Both
damon_targets_empty()anddamon_nr_running_ctxs()have had no in-tree users since commit5ec4333b1967("mm/damon: remove DAMON debugfs interface") removed their remaining callers.Remove the unused declarations and definitions.
Tested with:
make O=../linux-build-mm W=1 mm/damon
Nice catch and cleanup, thnk you!
I applied this patch to damon/next [1] tree. We are now quite close to next merge window. We (mm community) want to focus on making mm.git more stabilized and therefore ready for the next merge window, rather than adding more changes that are not really urgent. I understand this series is not really urgent. Hence, Andrew might not add this patch until next -rc1 release. In the case, I will request adding this to mm.git after next -rc1 release. So, no action from your side is needed for now. Let me know if you think this is really urgent.
[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees
Thanks,
SJ
[...]