summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2025-07-06 12:32:06 -0700
committerAndrew Morton <akpm@linux-foundation.org>2025-07-13 16:38:34 -0700
commitb91b82e241822ef1f287c3a8214f7bdeef4e85b2 (patch)
tree1cacba8300c770c9f8202487dffe3d3f7d589672
parent737e40d5eb2f6507113285cb52c50a4a6b01f44a (diff)
mm/damon/lru_sort: reset enabled when DAMON start failed
When the startup fails, 'enabled' parameter is not reset. As a result, users show the parameter 'Y' while it is not really working. Fix it by resetting 'enabled' to 'false' when the work is failed. Link: https://lkml.kernel.org/r/20250706193207.39810-6-sj@kernel.org Fixes: 7a034fbba336 ("mm/damon/lru_sort: enable and disable synchronously") Signed-off-by: SeongJae Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r--mm/damon/lru_sort.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 4af8fd4a390b..9bd8a1a115e0 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -325,7 +325,7 @@ static int __init damon_lru_sort_init(void)
int err = damon_modules_new_paddr_ctx_target(&ctx, &target);
if (err)
- return err;
+ goto out;
ctx->callback.after_wmarks_check = damon_lru_sort_after_wmarks_check;
ctx->callback.after_aggregation = damon_lru_sort_after_aggregation;
@@ -334,6 +334,9 @@ static int __init damon_lru_sort_init(void)
if (enabled)
err = damon_lru_sort_turn(true);
+out:
+ if (err && enabled)
+ enabled = false;
return err;
}