linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Josh Don <joshdon@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>,
	Daniel Bristot de Oliveira <bristot@redhat.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Clement Courbet <courbet@google.com>,
	Oleg Rombakh <olegrom@google.com>
Subject: Re: [PATCH] sched: Optimize __calc_delta.
Date: Wed, 3 Mar 2021 10:49:27 +0100	[thread overview]
Message-ID: <YD9bp7C9k6ojjq/5@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CABk29Nv7iJEcDg3rgSvfTkXEM69ZeLByJAsZYuA5qpdj645nZw@mail.gmail.com>

On Tue, Mar 02, 2021 at 12:55:07PM -0800, Josh Don wrote:
> On Fri, Feb 26, 2021 at 1:03 PM Peter Zijlstra <peterz@infradead.org> wrote:
> >
> > On Fri, Feb 26, 2021 at 11:52:39AM -0800, Josh Don wrote:
> > > From: Clement Courbet <courbet@google.com>
> > >
> > > A significant portion of __calc_delta time is spent in the loop
> > > shifting a u64 by 32 bits. Use a __builtin_clz instead of iterating.
> > >
> > > This is ~7x faster on benchmarks.
> >
> > Have you tried on hardware without such fancy instructions?
> 
> Was not able to find any on hand unfortunately. Clement did rework the
> patch to use fls() instead, and has benchmarks for the generic and asm
> variations. All of which are faster than the loop. In my next reply,
> I'll include the updated patch inline.

Excellent; I have some vague memories where using fls ended up slower
for some ARMs, but I can't seem to remember enough to even Google it :/

  parent reply	other threads:[~2021-03-03 14:33 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 19:52 [PATCH] sched: Optimize __calc_delta Josh Don
2021-02-26 21:03 ` Peter Zijlstra
2021-03-02 20:55   ` Josh Don
2021-03-02 20:57     ` Josh Don
2021-03-03  9:56       ` Peter Zijlstra
2021-03-03 21:59         ` Josh Don
2021-03-03 22:46         ` [PATCH v2] " Josh Don
2021-03-04  8:31           ` Peter Zijlstra
2021-03-04 17:34           ` Nick Desaulniers
2021-03-04 18:24             ` Sedat Dilek
2021-03-04 19:21               ` Sedat Dilek
2021-03-05  1:04             ` Josh Don
2021-03-05 17:13             ` David Laight
2021-03-10 11:26           ` [tip: sched/core] sched: Optimize __calc_delta() tip-bot2 for Clement Courbet
2021-03-03 10:02       ` [PATCH] sched: Optimize __calc_delta Peter Zijlstra
2021-03-03 22:00         ` Josh Don
2021-03-03  9:49     ` Peter Zijlstra [this message]
2021-02-28 15:15 ` [sched] 4112549ee5: WARNING:at_kernel/rcu/rcutorture.c:#rcu_torture_fwd_prog_nr[rcutorture] kernel test robot

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=YD9bp7C9k6ojjq/5@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=courbet@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=joshdon@google.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=olegrom@google.com \
    --cc=rostedt@goodmis.org \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).