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=1796387199; b=4L8an1kVZXWZc8aYbA3vPMHWbztEELlksxpvMAcMJ87C+axUSsiIUk/na7tm0fc9pgTg WLlGvDNyngv1rfhulQAo/ulKuZBNgr8NT4S8oYJuwOfM2Po31xW760eFwCTZSPtJ1YIXj EPjEL/NV3Riti1g7jmOJFn8FXA/acJCwDgO6Y6lCmP3HeLDnsZe+EnhkWwS2I55L/AoKl acCOYQHbSkpWZGB8sqSo01MZ4gMBHM/ODQ+GGPifsp703LLb99YfV3zP3pXcmGBfamk2F My+e4PpQ2E6luRY/1uj/5Drw/o/D5puri4x80qJLd3RrauAtcyYJIWu07X+mLCzXXhA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387199; 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=/HHfsnNqkrc5Z8yKAOOCRBW4j6SfsfTcQcfJ8JJbkxw=; b=y0suPozdRYroHBNPUlU5cAj/I3Wxs8pjUW4LrtGcod4uA+8lPnmFzgz18Izjr0/T+Dd4 173cxUqFI1Fwm90PWoFlbvc+AbZVqpapws51WX6blUaok1xYs/lsNzdYIc+r3wHCUmEfA 46o1V1twGrbmU2OYkQb/ZtnU2unZujteOAxfv0wC68fh+Rfyj51lPqJFp7A+4hUj/4VyC 6Im2f6wQDSYtJi/cAaXGZmepM6Xjg/AbwG+pMy5io/BGB5HDs9UrKNuu9zN91g8RZJFgn SwB/8Oovx45lIVa3/I6n6yeLo6upOggcY2+EtM5ja8q9/kXcHS+B+dznwMRuiVJP2Qw== 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=IDk2m2ZW; 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 73265606A322; Fri, 4 Dec 2026 12:26:39 +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=IDk2m2ZW Received: by smtp.kernel.org (Postfix) with ESMTPSA id E80BB1F0092C; Fri, 4 Dec 2026 12:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387199; bh=/HHfsnNqkrc5Z8yKAOOCRBW4j6SfsfTcQcfJ8JJbkxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IDk2m2ZWnMihhWrbfYcmpoEDEUWKTMTlDWgwEv1cIePFAz+6i8m9bBqo8P2QxeZ2o Tw7KQ0gMiD0vejVnRG7BT5Lg2U4Mug9qgb+gHYmgb/yTrdyKvHHstrsAL5PWBGJRtL MxAWnnXcWrkNm6EYhw99a7BA6sJ/wLsWfz0owPlI= 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.1 0142/1059] sched/pelt: Fix u32 truncation of the PELT period count Date: Fri, 4 Dec 2026 18:54:33 +0900 Message-ID: <20261204100647.895939812@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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