Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.12.y] mm/damon/reclaim: use parameter context correctly
@ 2026-11-17  2:51 SJ Park
  2026-11-17  3:09 ` SJ Park
  0 siblings, 1 reply; 2+ messages in thread
From: SJ Park @ 2026-11-17  2:51 UTC (permalink / raw)
  To: stable; +Cc: SeongJae Park, Andrew Morton, damon, linux-kernel, linux-mm

From: SeongJae Park <sj@kernel.org>

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>
(cherry picked from commit fed48693bdfeca666f7536ba88a05e9a4e5523b6)
Signed-off-by: SJ Park <sj@kernel.org>
---
Mark Polyakov found [1] this patch is missed in 6.12.y and causing an
issue.

[1] https://lore.kernel.org/CAA5JH2yO-gw1gn_172hv0YWFfQpkXz915a=uoVH+e49P_D8-+Q@mail.gmail.com

 mm/damon/reclaim.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/damon/reclaim.c b/mm/damon/reclaim.c
index 9df096218beb7..254d84166131f 100644
--- a/mm/damon/reclaim.c
+++ b/mm/damon/reclaim.c
@@ -190,7 +190,7 @@ static int damon_reclaim_apply_parameters(void)
 		goto out;
 	}
 
-	err = damon_set_attrs(ctx, &damon_reclaim_mon_attrs);
+	err = damon_set_attrs(param_ctx, &damon_reclaim_mon_attrs);
 	if (err)
 		goto out;
 
@@ -198,7 +198,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,

base-commit: 8ea1fd6d2beedbc49a917cdccea09a0354b64d5f
-- 
2.47.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6.12.y] mm/damon/reclaim: use parameter context correctly
  2026-11-17  2:51 [PATCH 6.12.y] mm/damon/reclaim: use parameter context correctly SJ Park
@ 2026-11-17  3:09 ` SJ Park
  0 siblings, 0 replies; 2+ messages in thread
From: SJ Park @ 2026-11-17  3:09 UTC (permalink / raw)
  To: SJ Park; +Cc: stable, Andrew Morton, damon, linux-kernel, linux-mm,
	Mark Polyakov

On Mon, 16 Nov 2026 18:51:42 -0800 SJ Park <sj@kernel.org> wrote:

> From: SeongJae Park <sj@kernel.org>
> 
> 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>
> (cherry picked from commit fed48693bdfeca666f7536ba88a05e9a4e5523b6)
> Signed-off-by: SJ Park <sj@kernel.org>
> ---
> Mark Polyakov found [1] this patch is missed in 6.12.y and causing an
> issue.

By the way, it was not picked for 6.12.y because I underestimated the bug and
therefore didn't Cc: stable@.  Sorry about that, Mark and stable@ maintainers.
Also appreciate again for the issue report, Mark!

> 
> [1] https://lore.kernel.org/CAA5JH2yO-gw1gn_172hv0YWFfQpkXz915a=uoVH+e49P_D8-+Q@mail.gmail.com


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-17  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17  2:51 [PATCH 6.12.y] mm/damon/reclaim: use parameter context correctly SJ Park
2026-11-17  3:09 ` SJ Park

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox