From: "tip-bot2 for Hui Su" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Hui Su <sh_def@163.com>,
"Peter Zijlstra (Intel)" <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Kayra Cizmeci <kayracizmeci@gmail.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/urgent] sched/pelt: Fix u32 truncation of the PELT period count
Date: Fri, 06 Nov 2026 09:50:36 -0000 [thread overview]
Message-ID: <179395863661.1009794.3409769608044766882.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20261023025207.2967903-1-sh_def@163.com>
The following commit has been merged into the sched/urgent branch of tip:
Commit-ID: a0c755e574e37fddb59edf175f27dc3877e7fe23
Gitweb: https://git.kernel.org/tip/a0c755e574e37fddb59edf175f27dc3877e7fe23
Author: Hui Su <sh_def@163.com>
AuthorDate: Fri, 23 Oct 2026 11:52:07 +09:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 06 Nov 2026 10:04:11 +01:00
sched/pelt: Fix u32 truncation of the PELT period count
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 <sh_def@163.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
Link: https://patch.msgid.link/20261023025207.2967903-1-sh_def@163.com
---
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 779eb58..d10d57b 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -99,7 +99,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)
{
prev parent reply other threads:[~2026-11-06 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 2:52 [PATCH v2] sched/pelt: Fix " Hui Su
2026-10-23 3:22 ` K Prateek Nayak
2026-11-06 9:50 ` tip-bot2 for Hui Su [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179395863661.1009794.3409769608044766882.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=kayracizmeci@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=sh_def@163.com \
--cc=vincent.guittot@linaro.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®