From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 294FF3E0C67 for ; Tue, 28 Jul 2026 08:50:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785228604; cv=none; b=EAVjfyLCQiqF7pIicfxIHXbsvuebiAvm0pQczsTb/gVi6gFNCCZedObGLBBwaPwYELnm4bdrtIuBGtAlCcxbHMrnnyeHWtFlEbmBMmHt6LnnzdFu+Rr4ceiQeYLwpr91lbpkeaqrEsdNXWw+3hCZ/k/RRc15OG+aJXNmcPk+NBo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785228604; c=relaxed/simple; bh=N7WWZUGRYYFXYgMTSewVGX8b/JyhSyt31ft3Wp+jxAo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=q7rt0wlCu9V3iz0Ofgo8I/2cmR46L5KrGL2+XXS3PstR78tgbmChUL4inWEB7aO+i+tG1ljDTWm97SZBJj5IgGFWzH7D9KK7L3uvkFi/V6KeBhJPVBJH7IgCaQK7fL/u+Jl002hJXjiZB7+Xsid7cnfy6c6KIp+cd+h5um4SX8Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=iTR2Mmsy; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="iTR2Mmsy" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785228599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=N7WWZUGRYYFXYgMTSewVGX8b/JyhSyt31ft3Wp+jxAo=; b=iTR2MmsyOR1QTYkdyzHMCWYq0Y+cUfpUDGJiBYKXPy4JnadWSRE0QgFyWjukzc1OKSQmJO gj4BJTq8YMW7dbQPNWRYzhpNfxmZUxetoyppc9xWWBKIXExP6jEEMKDzWuLDOHVgah/Xt3 8rbcVoWWAkWuR8L3d7zTOpGt4DdYZ9Y= From: Tao Cui To: guopeng.zhang@linux.dev Cc: akpm@linux-foundation.org, bsegall@google.com, dietmar.eggemann@arm.com, hannes@cmpxchg.org, juri.lelli@redhat.com, kprateek.nayak@amd.com, linux-kernel@vger.kernel.org, mgorman@suse.de, mingo@redhat.com, peterz@infradead.org, rostedt@goodmis.org, surenb@google.com, vincent.guittot@linaro.org, vschneid@redhat.com, cui.tao@linux.dev, Tao Cui Subject: Re: [PATCH 1/2] sched/psi: Fix long-window growth interpolation Date: Tue, 28 Jul 2026 16:49:31 +0800 Message-ID: <20260728084931.2364795-1-cui.tao@linux.dev> In-Reply-To: <20260717102824.985950-2-guopeng.zhang@linux.dev> References: <20260717102824.985950-2-guopeng.zhang@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Tao Cui On Fri, Jul 17, 2026 at 3:29 AM Guopeng Zhang wrote: > > From: Guopeng Zhang > > 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 Acked-by: Tao Cui