From: John Stultz <john.stultz@linaro.org>
To: Chris Metcalf <cmetcalf@mellanox.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Salman Qazi <sqazi@google.com>, Paul Turner <pjt@google.com>,
Tony Lindgren <tony@atomide.com>, Steven Miao <realmz6@gmail.com>,
lkml <linux-kernel@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count
Date: Wed, 16 Nov 2016 12:29:45 -0800 [thread overview]
Message-ID: <CALAqxLXywSrTLx7gTbouYptDBkpYhRGN3j7G-D3SE1DDF+K0dg@mail.gmail.com> (raw)
In-Reply-To: <c656758a-8299-0b96-6d87-23f9beafc481@mellanox.com>
On Wed, Nov 16, 2016 at 12:16 PM, Chris Metcalf <cmetcalf@mellanox.com> wrote:
> On 11/16/2016 2:59 PM, John Stultz wrote:
>>
>> In your earlier patch, you mentioned this was similar to 4cecf6d401a0
>> ("sched, x86: Avoid unnecessary overflow in
>> sched_clock"). It might be better to actually try to use similar logic
>> there, to make sure the performance impact is minimal.
>
>
> This was the first thing I looked at when I saw the mult_frac()
> implementation. The modulus operations are indeed converted to
> bitmasks and the divides to shifts. We do have to do two multiplies
> instead of one, but that's basically the worst of the cost.
>
> Change 4cecf6d401a0 results in essentially identical code for x86 as
> this proposed change does for tile. In fact a follow-on change by
> Salman introduced mult_frac() and switched to using it, so it was
> identical at that point.
>
> PeterZ (cc'ed) then improved it to use __int128 math via
> mul_u64_u32_shr(), but that doesn't help tile; we only do one multiply
> instead of two, but the multiply is handled by an out-of-line call to
> __multi3, and the sched_clock() function ends up about 2.5x slower as
> a result.
>
> Thanks for thinking about this!
Heh. Thanks for the history lesson and apologies for my forgetfulness. :)
thanks
-john
next prev parent reply other threads:[~2016-11-16 20:29 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 16:57 [PATCH] clocksource_cyc2ns: avoid overflowing 64 bits Chris Metcalf
2016-11-16 18:04 ` John Stultz
2016-11-16 19:30 ` Chris Metcalf
2016-11-16 19:35 ` [PATCH v2] tile: avoid using clocksource_cyc2ns with absolute cycle count Chris Metcalf
2016-11-16 19:59 ` John Stultz
2016-11-16 20:16 ` Chris Metcalf
2016-11-16 20:29 ` John Stultz [this message]
2016-11-16 20:31 ` John Stultz
2016-11-17 9:53 ` Peter Zijlstra
2016-11-17 20:00 ` Chris Metcalf
2016-11-18 10:34 ` Peter Zijlstra
2016-11-18 14:24 ` Chris Metcalf
2016-11-18 14:50 ` Peter Zijlstra
2016-11-16 19:40 ` [PATCH] clocksource_cyc2ns: avoid overflowing 64 bits John Stultz
2016-11-16 19:45 ` John Stultz
2016-11-16 19:56 ` Chris Metcalf
2016-11-16 20:00 ` John Stultz
2016-11-16 20:30 ` Chris Metcalf
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=CALAqxLXywSrTLx7gTbouYptDBkpYhRGN3j7G-D3SE1DDF+K0dg@mail.gmail.com \
--to=john.stultz@linaro.org \
--cc=cmetcalf@mellanox.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=realmz6@gmail.com \
--cc=sqazi@google.com \
--cc=tglx@linutronix.de \
--cc=tony@atomide.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;
as well as URLs for NNTP newsgroup(s).