mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/pelt: Fix truncation of the PELT period count
@ 2026-10-22  3:49 Hui Su
  2026-10-22  8:34 ` K Prateek Nayak
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hui Su @ 2026-10-22  3:49 UTC (permalink / raw)
  To: Ingo Molnar, Peter Zijlstra, Juri Lelli, Vincent Guittot
  Cc: Dietmar Eggemann, Steven Rostedt, Ben Segall, Mel Gorman,
	Valentin Schneider, K Prateek Nayak, linux-kernel, Hui Su

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 only whether any period elapsed, which is all the caller
needs.

Signed-off-by: Hui Su <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 779eb58a4261..519bc9c40043 100644
--- a/kernel/sched/pelt.c
+++ b/kernel/sched/pelt.c
@@ -146,7 +146,7 @@ accumulate_sum(u64 delta, struct sched_avg *sa,
 	if (running)
 		sa->util_sum += contrib << SCHED_CAPACITY_SHIFT;
 
-	return periods;
+	return !!periods;
 }
 
 /*
-- 
2.55.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-10-22 14:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22  3:49 [PATCH] sched/pelt: Fix truncation of the PELT period count Hui Su
2026-10-22  8:34 ` K Prateek Nayak
2026-10-22  8:39   ` Vincent Guittot
2026-10-22  9:37   ` Hui Su
2026-10-22  8:37 ` Vincent Guittot
2026-10-22  9:37   ` Hui Su
2026-10-22 14:27 ` Kayra Cizmeci

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®