Commit 3a69f163 authored by SeongJae Park's avatar SeongJae Park Committed by Andrew Morton
Browse files

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: default avatarSeongJae Park <sj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f59ae147
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2657,6 +2657,7 @@ static int kdamond_fn(void *data)
		running_exclusive_ctxs = false;
	mutex_unlock(&damon_lock);

	damon_destroy_targets(ctx);
	return 0;
}