From: SeongJae Park Date: Thu, 15 Jan 2026 15:20:44 +0000 (-0800) Subject: mm/damon/reclaim: use damon_kdamond_pid() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33402229d28d837ceb4c8bcebc96dc509d9203f9;p=thirdparty%2Fkernel%2Flinux.git mm/damon/reclaim: use damon_kdamond_pid() DAMON_RECLAIM directly uses damon_ctx->kdamond field with manual synchronization using damon_ctx->kdamond_lock, to get the pid of the kdamond. Use a new dedicated function for the purpose, namely damon_kdamond_pid(), since that doesn't require manual and error-prone synchronization. Link: https://lkml.kernel.org/r/20260115152047.68415-5-sj@kernel.org Signed-off-by: SeongJae Park Signed-off-by: Andrew Morton --- diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c index 8463a5a5032f2..55df43e241c5d 100644 --- a/mm/damon/reclaim.c +++ b/mm/damon/reclaim.c @@ -307,7 +307,9 @@ static int damon_reclaim_turn(bool on) err = damon_start(&ctx, 1, true); if (err) return err; - kdamond_pid = ctx->kdamond->pid; + kdamond_pid = damon_kdamond_pid(ctx); + if (kdamond_pid < 0) + return kdamond_pid; return damon_call(ctx, &call_control); }