Re: [PATCH] mm/damon/core: do not overwrite wmarks.activated in damos_commit()
From: SJ Park
Date: Sat Nov 21 2026 - 20:22:39 EST
On Sat, 21 Nov 2026 16:29:30 -0800 Yifan Feng <evanfengff@xxxxxxxxx> wrote:
> damos_commit() copies the whole wmarks struct from the source scheme,
> including the private 'activated' field. The source scheme is a new
> one, so the field is always true there.
>
> As a result, a commit turns on a scheme that the watermarks turned off.
> If the metric is between mid and high at that time, the scheme keeps
> running, though it should stay off until the metric goes below mid.
> DAMON_RECLAIM and DAMON_LRU_SORT use the same path for commit_inputs.
>
> Save 'activated' before the copy and restore it after.
Thank you for finding the issue and sharing this patch.
> Do not restore
> it for DAMOS_WMARK_NONE, because nothing sets it again in that case and
> the scheme would stay off.
Is this really necessary? If not, I'd prefer restoring it always for
simplicity.
Thanks,
SJ
[...]