diff --git a/mm/damon/core.c b/mm/damon/core.c index 0c8ac11a49f9..0bed937b1dce 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -2856,14 +2856,13 @@ static int kdamond_fn(void *data) kfree(ctx->regions_score_histogram); kdamond_call(ctx, true); + damos_walk_cancel(ctx); pr_debug("kdamond (%d) finishes\n", current->pid); mutex_lock(&ctx->kdamond_lock); ctx->kdamond = NULL; mutex_unlock(&ctx->kdamond_lock); - damos_walk_cancel(ctx); - mutex_lock(&damon_lock); nr_running_ctxs--; if (!nr_running_ctxs && running_exclusive_ctxs)