Re: [PATCH 1/2] sched/psi: Fix long-window growth interpolation

From: Tao Cui

Date: Tue Jul 28 2026 - 05:18:34 EST


From: Tao Cui <cuitao@xxxxxxxxxx>

On Fri, Jul 17, 2026 at 3:29 AM Guopeng Zhang <guopeng.zhang@xxxxxxxxx> wrote:
>
> From: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>
>
> PSI trigger windows are stored in nanoseconds and can be up to 10
> seconds, but window_update() stores the remaining interval in a u32.
> For example, after 2 seconds have elapsed in a 10-second window, the
> remaining 8,000,000,000 ns is truncated to 3,705,032,704 ns.
>
> Making remaining a u64 avoids the truncation, but the multiplication
> can still overflow before the division. Both win->prev_growth and
> remaining can be close to 10,000,000,000, so their product can exceed
> U64_MAX.
>
> Store the remaining interval in a u64 and use
> mul_u64_u64_div_u64() to calculate the interpolation without
> overflowing the intermediate product.
>
> Fixes: 0e94682b73bf ("psi: introduce psi monitor")
> Signed-off-by: Guopeng Zhang <zhangguopeng@xxxxxxxxxx>

Acked-by: Tao Cui <cuitao@xxxxxxxxxx>