Re: [PATCH v2] mm/damon/core: allow esz to be set to zero

From: Liew Rui Yan

Date: Wed Sep 02 2026 - 10:44:55 EST


On Wed, 02 Sep 2026 07:13:48 -0700 SJ Park <sj@xxxxxxxxxx> wrote:

> On Wed, 2 Sep 2026 16:20:50 +0800 Liew Rui Yan <aethernet65535@xxxxxxxxx> wrote:
>
> > When the temporal quota goal tuner determines that the goal has been
> > achieved (score >= 10000), it sets esz_bp to zero so that the effective
> > quota (esz) becomes zero. However, damos_set_effective_quota() clamps
> > the quota to min_region_sz, preventing the quota from ever reaching
> > zero.
>
> Where in the code it is clamped to min_region_sz, when? And what user issue
> this can cause?

In damos_set_effective_quota(), when quota->ms is set.

'''
if (quota->ms) {
if (quota->total_charged_ns)
throughput = mult_frac(quota->total_charged_sz,
1000000, quota->total_charged_ns);
else
throughput = PAGE_SIZE * 1024;
esz = min(throughput * quota->ms, esz);
esz = max(ctx->min_region_sz, esz); /* <- HERE */
}
'''

This is a minor issue, the main problem is that it doesn't match the
description in the documentation, which states that if the goal has
already been [over-]achieved, the quota will be set to 0.

Original documentation:

- ``temporal``: More straightforward algorithm. Tries to achieve the goal as
fast as possible, using maximum allowed quota, but only for a temporal short
time. When the quota is under-achieved, this algorithm keeps tuning quota to
a maximum allowed one. Once the quota is [over]-achieved, this sets the
quota zero. Useful for deterministic control required environments.

Best regards,
Rui Yan