[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250813171521.6482-1-sj@kernel.org>
Date: Wed, 13 Aug 2025 10:15:21 -0700
From: SeongJae Park <sj@...nel.org>
To: Quanmin Yan <yanquanmin1@...wei.com>
Cc: SeongJae Park <sj@...nel.org>,
akpm@...ux-foundation.org,
damon@...ts.linux.dev,
linux-kernel@...r.kernel.org,
linux-mm@...ck.org,
wangkefeng.wang@...wei.com,
zuoze1@...wei.com
Subject: Re: [RFC PATCH -next 16/16] mm/damon/core: handle quota->esz overflow issues
On Wed, 13 Aug 2025 13:07:06 +0800 Quanmin Yan <yanquanmin1@...wei.com> wrote:
> In the original quota enforcement implementation, the traffic
> calculation multiplied A by 1000000 due to time unit conversion,
> making it highly prone to overflow on 32-bit systems:
>
> damos_set_effective_quota
> if (quota->total_charged_ns)
> throughput = quota->total_charged_sz * 1000000 /
> quota->total_charged_ns;
>
> Requiring total_charged_sz to be less than 4GB/1000000 is unreasonable.
> Additionally, when overflow occurs and causes quota->esz to become
> extremely small, the subsequent damos_apply_scheme logic permanently
> sets sz to 0, while quota stop updating, ultimately leading to complete
> functional failure:
>
> damos_apply_scheme
> if (quota->esz && quota->charged_sz + sz > quota->esz)
> sz = ALIGN_DOWN(quota->esz - quota->charged_sz, DAMON_MIN_REGION);
>
> Total charged stats use the unsigned long long data type to reduce
> overflow risk, with data reset capability after overflow occurs.
Thank you for finding this issue! I don't want to change the data type if
possible, though. Could replacing the easily-overflowing throughput
calculation with mult_frac() fix the issue?
Thanks,
SJ
[...]
Powered by blists - more mailing lists