* [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero [not found] <2026100358-repayment-destitute-a6a6@gregkh> @ 2026-10-03 15:46 ` SJ Park 2026-10-03 17:56 ` sashiko-bot 2026-10-04 16:29 ` Sasha Levin 0 siblings, 2 replies; 4+ messages in thread From: SJ Park @ 2026-10-03 15:46 UTC (permalink / raw) To: stable; +Cc: damon, SJ Park, Andrew Morton, Kunwu Chan DAMOS could unexpectedly stop working when a user disables quota using the online parameters commit feature. Fix it by correcting a wrong quota unset check in damos_adjust_quota(). DAMON users could disable all quotas by unsetting time and size quotas, and removing all quota goals. The intention of disabling quotas would be making DAMOS run at full speed. When such quota disabled setup is detected, damos_adjust_quota() skips all its work. The skipped works include effective size quota (damos_quota->esz) updates and charged quota amount (damos_quota->charged_sz) resets. The intention is to avoid doing unnecessary work when quotas are disabled. However, users could do the setup while effective size quota is non-zero, by doing the disabling with the online DAMON parameters commit feature. In this case, because the effective size quota exists, DAMOS will keep working with the quota until it is fully charged. After the effective quota is fully charged, the charged quota amount (damos_quota->charged_sz) cannot be reset because damos_adjust_quota() skips it. Then, DAMOS stops working until the quota is newly set or DAMON is entirely restarted. The problem happens because damos_adjust_quota() assumes the user setup for disabling quota immediately disabled it. In reality, the quota is still working until the effective size quota is also updated to zero. Other logic for catching that uses damos_quota_is_set(), which understands the fact and therefore checks the effective size quota in addition to the user setup. Fix the issue by using damos_quota_is_set() in damos_adjust_quota() to determine if its works should be skipped. The user impact is a non-deterministic and unexpected DAMOS stop behavior. That is, users would disable quotas using the online parameters commit feature, expecting DAMOS will run at full speed. However, depending on the timing, the setup can be updated while the effective size quota is non-zero. Due to the above mentioned internal mechanism, DAMOS stops working instead of running at full speed. It is unexpected behavior. It is also non-deterministic because sometimes the setup is done when the effective size quota is zero, depending on the timing. It doesn't cause critical issues like crashes or leaks. Users can simply set a reasonable quota again, or restart DAMON. But definitely it is an unexpected and non-deterministic behavior that makes it difficult to reliably use. Also investigating the root cause of the behavior would be quite difficult. Link: https://lore.kernel.org/20260916135020.86483-1-sj@kernel.org Fixes: da87878010e5 ("mm/damon/sysfs: support online inputs update") Signed-off-by: SJ Park <sj@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com> Cc: <stable@vger.kernel.org> # 5.19.x Signed-off-by: SJ Park <sj@kernel.org> --- mm/damon/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/damon/core.c b/mm/damon/core.c index 32737cc5f877..2f6d60b9ca0f 100644 --- a/mm/damon/core.c +++ b/mm/damon/core.c @@ -1677,7 +1677,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) unsigned long cumulated_sz; unsigned int score, max_score = 0; - if (!quota->ms && !quota->sz && list_empty("a->goals)) + if (!quota->esz && !quota->ms && !quota->sz && + list_empty("a->goals)) return; /* First charge window */ -- 2.47.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero 2026-10-03 15:46 ` [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero SJ Park @ 2026-10-03 17:56 ` sashiko-bot 2026-10-03 18:04 ` SJ Park 2026-10-04 16:29 ` Sasha Levin 1 sibling, 1 reply; 4+ messages in thread From: sashiko-bot @ 2026-10-03 17:56 UTC (permalink / raw) To: SJ Park; +Cc: damon Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] mm/damon: commit message claims to use non-existent damos_quota_is_set() -- commit b8bc1e659853d831a5550c37c3c7adcd48423fd1 Author: SJ Park <sj@kernel.org> mm/damon/core: don't skip damos_adjust_quota() while esz is not zero This commit fixes an issue where DAMOS stops working unexpectedly when a user disables quota using the online parameters commit feature. It addresses this by updating damos_adjust_quota() to not skip its work while the effective size quota is non-zero. Link: https://lore.kernel.org/20260916135020.86483-1-sj@kernel.org > Other logic for catching that uses damos_quota_is_set(), which understands > the fact and therefore checks the effective size quota in addition to the > user setup. Fix the issue by using damos_quota_is_set() in > damos_adjust_quota() to determine if its works should be skipped. [ ... ] > diff --git a/mm/damon/core.c b/mm/damon/core.c > index 32737cc5f877b..2f6d60b9ca0f4 100644 > --- a/mm/damon/core.c > +++ b/mm/damon/core.c > @@ -1677,7 +1677,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) > unsigned long cumulated_sz; > unsigned int score, max_score = 0; > > - if (!quota->ms && !quota->sz && list_empty("a->goals)) > + if (!quota->esz && !quota->ms && !quota->sz && > + list_empty("a->goals)) [Severity: Medium] The commit message explicitly states the fix uses a helper function damos_quota_is_set(), but the code implements the check inline here in damos_adjust_quota() and the helper does not exist in the codebase. Should the commit message be updated to match the inline check, or is there a missing patch that introduces the damos_quota_is_set() helper function? > return; -- Sashiko AI review · https://sashiko.dev/#/patchset/20261003154616.22092-1-sj@kernel.org?part=1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero 2026-10-03 17:56 ` sashiko-bot @ 2026-10-03 18:04 ` SJ Park 0 siblings, 0 replies; 4+ messages in thread From: SJ Park @ 2026-10-03 18:04 UTC (permalink / raw) To: sashiko-bot; +Cc: SJ Park, damon On Sat, 03 Oct 2026 17:56:15 +0000 sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: > - [Medium] mm/damon: commit message claims to use non-existent damos_quota_is_set() > -- > > commit b8bc1e659853d831a5550c37c3c7adcd48423fd1 > Author: SJ Park <sj@kernel.org> > > mm/damon/core: don't skip damos_adjust_quota() while esz is not zero > > This commit fixes an issue where DAMOS stops working unexpectedly when a > user disables quota using the online parameters commit feature. It addresses > this by updating damos_adjust_quota() to not skip its work while the > effective size quota is non-zero. > > Link: https://lore.kernel.org/20260916135020.86483-1-sj@kernel.org > > > Other logic for catching that uses damos_quota_is_set(), which understands > > the fact and therefore checks the effective size quota in addition to the > > user setup. Fix the issue by using damos_quota_is_set() in > > damos_adjust_quota() to determine if its works should be skipped. > > [ ... ] > > > diff --git a/mm/damon/core.c b/mm/damon/core.c > > index 32737cc5f877b..2f6d60b9ca0f4 100644 > > --- a/mm/damon/core.c > > +++ b/mm/damon/core.c > > @@ -1677,7 +1677,8 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) > > unsigned long cumulated_sz; > > unsigned int score, max_score = 0; > > > > - if (!quota->ms && !quota->sz && list_empty("a->goals)) > > + if (!quota->esz && !quota->ms && !quota->sz && > > + list_empty("a->goals)) > > [Severity: Medium] > The commit message explicitly states the fix uses a helper function > damos_quota_is_set(), but the code implements the check inline here in > damos_adjust_quota() and the helper does not exist in the codebase. > > Should the commit message be updated to match the inline check, or is there > a missing patch that introduces the damos_quota_is_set() helper function? This is a backport of the mainline commit. I want to make the change as minimum as possible, so no blocker in my opinion. > > > return; > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/20261003154616.22092-1-sj@kernel.org?part=1 Thanks, SJ ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero 2026-10-03 15:46 ` [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero SJ Park 2026-10-03 17:56 ` sashiko-bot @ 2026-10-04 16:29 ` Sasha Levin 1 sibling, 0 replies; 4+ messages in thread From: Sasha Levin @ 2026-10-04 16:29 UTC (permalink / raw) To: stable; +Cc: Sasha Levin, damon, SJ Park, Andrew Morton, Kunwu Chan > DAMOS could unexpectedly stop working when a user disables quota using the > online parameters commit feature. Fix it by correcting a wrong quota > unset check in damos_adjust_quota(). Queued for 6.12, thanks. -- Thanks, Sasha ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-10-04 16:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2026100358-repayment-destitute-a6a6@gregkh>
2026-10-03 15:46 ` [PATCH 6.12.y] mm/damon/core: don't skip damos_adjust_quota() while esz is not zero SJ Park
2026-10-03 17:56 ` sashiko-bot
2026-10-03 18:04 ` SJ Park
2026-10-04 16:29 ` Sasha Levin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.