]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm/damon/reclaim: use parameter context correctly
authorSeongJae Park <sj@kernel.org>
Sun, 6 Jul 2025 19:32:07 +0000 (12:32 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 13 Jul 2025 23:38:34 +0000 (16:38 -0700)
damon_reclaim_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 mistakenly
over-writing the monitoring attributes and the reclaim scheme on the
running context.  It is not causing a real problem for monitoring
attributes, but the scheme overwriting can remove scheme's internal status
such as charged quota.  Fix the wrong use of the parameter context.

Link: https://lkml.kernel.org/r/20250706193207.39810-7-sj@kernel.org
Fixes: 11ddcfc257a3 ("mm/damon/reclaim: use damon_commit_ctx()")
Signed-off-by: SeongJae Park <sj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/damon/reclaim.c

index c91098d8aa51abeffd3da99490c1b9e7c9f74326..0fe8996328b8678f454c02d00f2988acc4ed97ee 100644 (file)
@@ -194,7 +194,7 @@ static int damon_reclaim_apply_parameters(void)
        if (err)
                return err;
 
-       err = damon_set_attrs(ctx, &damon_reclaim_mon_attrs);
+       err = damon_set_attrs(param_ctx, &damon_reclaim_mon_attrs);
        if (err)
                goto out;
 
@@ -202,7 +202,7 @@ static int damon_reclaim_apply_parameters(void)
        scheme = damon_reclaim_new_scheme();
        if (!scheme)
                goto out;
-       damon_set_schemes(ctx, &scheme, 1);
+       damon_set_schemes(param_ctx, &scheme, 1);
 
        if (quota_mem_pressure_us) {
                goal = damos_new_quota_goal(DAMOS_QUOTA_SOME_MEM_PSI_US,