Re: [PATCH v2.1] mm/damon/core: fix false positive in damos_quota_is_full() when esz is zero
From: Liew Rui Yan
Date: Sat Sep 05 2026 - 06:39:44 EST
On Fri, 04 Sep 2026 17:25:34 -0700 SJ Park <sj@xxxxxxxxxx> wrote:
> On Fri, 4 Sep 2026 23:35:38 +0800 Liew Rui Yan <aethernet65535@xxxxxxxxx> wrote:
>
> > That said, it's not important for me to add explanations to the
> > document, but may I know why commit [2] changed the behavior which
> > introduced by commit [1]?
> >
> > Commit [1] Behavior:
> >
> > if (quota->esz && quota->changed_sz >= quota->esz)
> > s->stat.qt_exceeds++;
> >
> > Commit [2] Behavior:
> >
> > if (damos_quota_is_full(quota, c->min_region_sz))
> > s->stat.qt_exceeds++;
> >
> > Before commit [2], qt_exceeds will only increase when quota->esz is not
> > zero, but after commit [2], qt_exceeds also increase even when
> > quota->esz is zero. I'd love to understand the rationale behind this
> > change to better grasp the design evolution.
> >
> > [1] 6268eac34ca30 ("mm/damon/schemes: account how many times quota limit has exceeded")
> > (Fri Jan 14 14:10:20 2022 -0800)
> > [2] c7ec7d5f6b3d1 ("mm/damon/core: handle <min_region_sz remaining quota as empty")
> > (Mon Apr 27 18:33:50 2026 -0700)
>
> Seems commit c7ec7d5f6b3d1 didn't make a behavior change that you are
> describing.
I actually wanted to point out the behavior difference between commit [1]
and [2], but I've understood and agreed with your point.
>
> '''
> $ git show c7ec7d5f6b3d1
> [...]
> @@ -2601,8 +2613,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
> if (!time_in_range_open(jiffies, quota->charged_from,
> quota->charged_from +
> msecs_to_jiffies(quota->reset_interval))) {
> - if (damos_quota_is_set(quota) &&
> - quota->charged_sz >= quota->esz)
> + if (damos_quota_is_full(quota, c->min_region_sz))
> s->stat.qt_exceeds++;
> quota->total_charged_sz += quota->charged_sz;
> quota->charged_from = jiffies;
> '''
>
> And I don't think there was a behavior change. Hopefully commit 54419bbd0ee3
> ("mm/damon/core: allow quota goals set zero effective size quota") will give
> you some clues.
Thank you very much for your clarifying :>
Now I completely understand why there is different behavior between
commit [1] and [2]. Because in commit [1], esz==0 only means quota is
unlimited. After commit 54419bbd0ee3, esz==0 also can means do not have
quota at all. But the qt_exceeds should just not increase when quota is
unlimited, that's why the current implementation is completely correct.
Best regards,
Rui Yan