From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Hui Su <sh_def@163.com>, Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>
Cc: 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>,
Kayra Cizmeci <kayracizmeci@gmail.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] sched/pelt: Fix truncation of the PELT period count
Date: Fri, 23 Oct 2026 08:52:58 +0530 [thread overview]
Message-ID: <9d1381a4-6f4f-48aa-b76f-fad11e9d5bc9@amd.com> (raw)
In-Reply-To: <20261023025207.2967903-1-sh_def@163.com>
Hello Hui,
On 10/23/2026 8:22 AM, 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 the period count as u64 so the caller can test it without
> truncation.
>
> Fixes: a481db34b9be ("sched/fair: Optimize ___update_sched_avg()")
> Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
> Reviewed-by: Kayra Cizmeci <kayracizmeci@gmail.com>
> Signed-off-by: Hui Su <sh_def@163.com>
Feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
> ---
> Changes in v2:
> - Return the PELT period count as u64.
> - Add the Fixes tag and Kayra Cizmeci's Reviewed-by.
>
> v1: https://lore.kernel.org/lkml/20261022034930.225042-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 779eb58a4261..d10d57b6b8ec 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)
> {
>
> base-commit: a804c5742bff224d4cb4d25dd383554d598be32b
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2026-10-23 3:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 2:52 Hui Su
2026-10-23 3:22 ` K Prateek Nayak [this message]
2026-11-06 9:50 ` [tip: sched/urgent] sched/pelt: Fix u32 " tip-bot2 for Hui Su
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=9d1381a4-6f4f-48aa-b76f-fad11e9d5bc9@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kayracizmeci@gmail.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®