[PATCH] mm/damon/lru_sort: use param_ctx for damon_attrs staging

SeongJae Park posted 1 patch 2 weeks, 2 days ago
mm/damon/lru_sort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] mm/damon/lru_sort: use param_ctx for damon_attrs staging
Posted by SeongJae Park 2 weeks, 2 days ago
damon_lru_sort_apply_parameters() allocates a new DAMON context, stages
user-specified DAMON parameters on it, and commits to running DAMON
context at once, using damon_commit_ctx().  The code is, however,
directly updating the monitoring attributes of the running context.  And
the attributes are over-written by later damon_commit_ctx() call.  This
means that the monitoring attributes parameters are not really working.
Fix the wrong use of the parameter context.

Fixes: a30969436428 ("mm/damon/lru_sort: use damon_commit_ctx()")
Cc: <stable@vger.kernel.org> # 6.11.x
Signed-off-by: SeongJae Park <sj@kernel.org>
Reviewed-by: Joshua Hahn <joshua.hahnjy@gmail.com>
---
This was a part of misc fixes and improvements for 6.18 [1], but Joshua
thankfully found this is fixing a real user visible bug.  So sending this
separately as a hotfix.

[1] https://lore.kernel.org/20250915015807.101505-4-sj@kernel.org

 mm/damon/lru_sort.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/damon/lru_sort.c b/mm/damon/lru_sort.c
index 14d31009c09e..ab6173a646bd 100644
--- a/mm/damon/lru_sort.c
+++ b/mm/damon/lru_sort.c
@@ -219,7 +219,7 @@ static int damon_lru_sort_apply_parameters(void)
 		goto out;
 	}
 
-	err = damon_set_attrs(ctx, &damon_lru_sort_mon_attrs);
+	err = damon_set_attrs(param_ctx, &damon_lru_sort_mon_attrs);
 	if (err)
 		goto out;
 

base-commit: ea93a9235c1c6e61cfa6e5612b7b6b3fc41e79e1
-- 
2.39.5