From: Peter Zijlstra <peterz@infradead.org>
To: Chris Wiseman <chriswiseman@google.com>
Cc: Ingo Molnar <mingo@redhat.com>,
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>,
Qais Yousef <qyousef@google.com>,
John Stultz <jstultz@google.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] sched/pelt: Skip redundant decay and divisions when sched_avg is zero
Date: Tue, 17 Nov 2026 16:46:56 +0100 [thread overview]
Message-ID: <20261117154656.GJ1813469@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <18e8d60c92652608.3137322e32332e3235332e313736.371783.0000sendgmr@google.com>
On Tue, Nov 17, 2026 at 12:50:01PM +0000, Chris Wiseman wrote:
> + sa->load_avg = sa->load_sum ? div_u64(load * sa->load_sum, divider) : 0;
> + sa->runnable_avg = sa->runnable_sum ?
> + div_u64(sa->runnable_sum, divider) : 0;
> + WRITE_ONCE(sa->util_avg,
> + sa->util_sum ? sa->util_sum / divider : 0);
This is micro-architectural.
Gemini is trying to sell me:
IDIV latency (32/64) Branch mispredict
Apple P-core (M4 tested): 7 13-15
AMD Zen[45]: 10-13 / 15-20 15-20
Intel Golven Cove+: 12-16 17-22
So on these architectures it is more expensive to mispredict than to
just do the division.
next prev parent reply other threads:[~2026-11-17 15:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 12:50 Chris Wiseman
2026-11-17 14:41 ` Vincent Guittot
2026-11-17 15:46 ` Peter Zijlstra [this message]
2026-11-17 16:05 ` Peter Zijlstra
2026-11-17 16:09 ` Vincent Guittot
2026-11-17 16:28 ` Chris Wiseman
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=20261117154656.GJ1813469@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bsegall@google.com \
--cc=chriswiseman@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=jstultz@google.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=qyousef@google.com \
--cc=rostedt@goodmis.org \
--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®