Re: [PATCH] mm/damon/stat: avoid 32-bit overflow in idle time milliseconds

From: SJ Park

Date: Tue Nov 17 2026 - 09:44:27 EST


Hello David,

On Tue, 17 Nov 2026 09:43:22 +0000 David Carlier <devnexen@xxxxxxxxx> wrote:

> On 32-bit, the region idle time in microseconds is computed in a long
> before the division to milliseconds. It wraps once a region has been
> idle for about 36 minutes regardless of the intervals, so the cold end
> of memory_idle_ms_percentiles reports wrong values with flipped signs.
>
> Do the multiplication in 64 bits and divide with div_s64() so the sign
> of recently accessed regions is kept.

Thank you for this patch. Looks good to me.

>
> Fixes: e5d2585d9e85 ("mm/damon/stat: calculate and expose idle time percentiles")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: David Carlier <devnexen@xxxxxxxxx>

Reviewed-by: SJ Park <sj@xxxxxxxxxx>

This patch is applied to damon/next [1] tree. I will repost it soon (~1 week)
as an mm.git merge request. So, no action from your side is needed for now.

[1] https://origin.kernel.org/doc/html/latest/mm/damon/maintainer-profile.html#scm-trees


Thanks,
SJ

[...]