From: Kayra Cizmeci <kayracizmeci@gmail.com>
To: Hui Su <sh_def@163.com>
Cc: Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/pelt: Fix truncation of the PELT period count
Date: Thu, 22 Oct 2026 17:27:38 +0300 [thread overview]
Message-ID: <atob2ttb0E-RTBc0@scheduler.schedules> (raw)
In-Reply-To: <20261022034930.225042-1-sh_def@163.com>
On Thu, Oct 22, 2026 at 12:49:30PM +0900, Hui Su wrote:
> 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;
> }
I think making this return value u64 is cleaner (As Prateek says).
Both works for me tho.
Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
>
> /*
> --
> 2.55.0
>
prev parent reply other threads:[~2026-10-22 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 3:49 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 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=atob2ttb0E-RTBc0@scheduler.schedules \
--to=kayracizmeci@gmail.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sh_def@163.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
/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®