Re: [PATCH 4/9] mm/damon/stat: avoid 32-bit overflow in idle percentiles
From: SJ Park
Date: Sun Nov 15 2026 - 12:33:57 EST
Hello David,
On Sat, 14 Nov 2026 18:10:34 +0000 David Carlier <devnexen@xxxxxxxxx> wrote:
> Hi SJ, Aveline,
>
> The value stored a few lines below has the same problem on 32-bit:
>
> damon_stat_idletime(region) *
> (long)c->attrs.aggr_interval / USEC_PER_MSEC;
>
> The product is the region's idle time in microseconds, held in a 32-bit
> long, so it wraps once a region has been idle for more than about 36
> minutes, whatever the intervals are. The cold-end percentiles then come
> out negative or wrong. Doing the multiply in s64 with div_s64() would
> keep the sign and avoid it.
>
> Hope it helps !
Yes, this is helpful. Thank you for sharing. Would you like to send a patch
for this issue?
Thanks,
SJ
[...]