From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384535; b=M5DbvJqimDJdz0aWp/+cXGWe8e+L88BAyYltep7vYwRDUQogP4NZGS7P1l1eekFQX7e5 VILF3GNLeSXBfupial9fz6DH1ZQhvrvpiDmM8qxK27DxUI6BGv6ezH4gV++XRGzrM/yG6 vQPRGtpaQDhvvcAO5MwkrImfK4TQLs6BueRhYvPO0/eMTW5bTR1FqaDzdrI2wXWcp+wod lABctkVZCC8/80mqXCHjcvoVrL0JIVVo4eM0Vv8dZtlIgsUb979/vlNq1h5Db5DToJbnu BK1mJg6YikFbjml9pFMgvfrZeYvGtIaXxa0YEsJbEVKkqIE+22lrCSv/Ru97J5NvPJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384535; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=CJSWOvzu9I2sHBBrF1uSqLmhpOjt1f299++zZnc2VAM=; b=HqLwqrYTQ5oseI0dJX4LM6D+hhYxCYPEhrh/703/RpKT5NwgSKy+4nl1z+gpzhitYZZZ m1VdVuavFskGTYSI9LwkexzoHoPNZmkZ5WoA0wMJlgudmA62HhIqV1/Zd4ggXhja/B1vw u+QGDdfrq3Hn0sRt+/iQUX5pCZXvf5+IZI0K5ESeuQnRb/jjVrB7s+0kI8+eIg/Mb4Har JwsVfVAoOi2JxLtHQehcI3oILil7jR9XqeLTXURbaWGkokwTrcjfHi5CcsEtc3xyxDb/i UGMIrTEyRTo2+S0outPoENXTqHCzreWMELhifZzTwL//IXRKh/pE7L21e2WfIb6k2+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wkpPZ2rg; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26D7A606A322; Fri, 4 Dec 2026 11:42:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=wkpPZ2rg Received: by smtp.kernel.org (Postfix) with ESMTPSA id 579451F000CE; Fri, 4 Dec 2026 11:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384534; bh=CJSWOvzu9I2sHBBrF1uSqLmhpOjt1f299++zZnc2VAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wkpPZ2rgmYW6sEIgMwmTmGmrg+PHPFuHs4hud/ZZ0z1nc1jkEuR4cAbzzG1FCu6cy G8dA9q5kShCcjRU50W3ne6vD27wIvWWpoDG/QOkvrHj2MfCw7P65v4dcDdNibkgUn/ KntIR5k4pwyBQsHr7whG49a1cbwKyDi0InAmmZpc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Hui Su , "Peter Zijlstra (Intel)" , Ingo Molnar , Vincent Guittot , Kayra Cizmeci , Sasha Levin Subject: [PATCH 6.6 0189/1167] sched/pelt: Fix u32 truncation of the PELT period count Date: Fri, 4 Dec 2026 18:53:36 +0900 Message-ID: <20261204100706.989124479@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Hui Su [ Upstream commit a0c755e574e37fddb59edf175f27dc3877e7fe23 ] accumulate_sum() computes the number of elapsed PELT periods in a u64 but returns u32. When the count is a multiple of 2^32, it is truncated to zero even though the PELT sums have been updated. The caller interprets zero as no period boundary crossed and skips recomputing the averages, leaving *_avg stale relative to *_sum. Return the period count as u64 so the caller can test it without truncation. Fixes: a481db34b9be ("sched/fair: Optimize ___update_sched_avg()") Signed-off-by: Hui Su Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Reviewed-by: Vincent Guittot Reviewed-by: Kayra Cizmeci Link: https://patch.msgid.link/20261023025207.2967903-1-sh_def@163.com Signed-off-by: Sasha Levin --- kernel/sched/pelt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c index 0f310768260c1..e7433f87c6294 100644 --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -98,7 +98,7 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3) * d1 y^p + 1024 \Sum y^n + d3 y^0 (Step 2) * n=1 */ -static __always_inline u32 +static __always_inline u64 accumulate_sum(u64 delta, struct sched_avg *sa, unsigned long load, unsigned long runnable, int running) { -- 2.53.0