]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/damon/core: destroy targets when kdamond_fn() finish
authorSeongJae Park <sj@kernel.org>
Sat, 12 Jul 2025 19:50:14 +0000 (12:50 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 20 Jul 2025 01:59:56 +0000 (18:59 -0700)
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 <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/core.c

index 9554743dc992b5cd8f7fa755db967da9e4aa5ef3..ffd1a061c2cbe66494ef9265873467f3969cb7ae 100644 (file)
@@ -2657,6 +2657,7 @@ done:
                running_exclusive_ctxs = false;
        mutex_unlock(&damon_lock);
 
+       damon_destroy_targets(ctx);
        return 0;
 }