From: SeongJae Park Date: Sat, 12 Jul 2025 19:50:14 +0000 (-0700) Subject: mm/damon/core: destroy targets when kdamond_fn() finish X-Git-Tag: v6.17-rc1~84^2~102 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a69f1635769e976151625798cc6597301150296;p=thirdparty%2Fkernel%2Flinux.git mm/damon/core: destroy targets when kdamond_fn() finish When kdamond_fn() completes, the targets are kept. Those are kept to let callers do additional cleanups if they need. There are no such additional cleanups though. DAMON sysfs interface deallocates those in before_terminate() callback, to reduce unnecessary memory usage, for [f]vaddr use case. Just destroy the targets for every case in the core layer. This saves more memory and simplifies the logic. Link: https://lkml.kernel.org/r/20250712195016.151108-13-sj@kernel.org Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton --- diff --git a/mm/damon/core.c b/mm/damon/core.c index 9554743dc992b..ffd1a061c2cbe 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2657,6 +2657,7 @@ done: running_exclusive_ctxs = false; mutex_unlock(&damon_lock); + damon_destroy_targets(ctx); return 0; }