Flexible I/O Tester development
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "Sam Bradshaw (sbradshaw)" <sbradshaw@micron.com>
Cc: "fio@vger.kernel.org" <fio@vger.kernel.org>
Subject: Re: [PATCH] gettime: minimize integer division
Date: Fri, 21 Dec 2012 22:30:33 +0100	[thread overview]
Message-ID: <50D4D4F9.5070606@kernel.dk> (raw)
In-Reply-To: <80B89753B40C5141A3E2D53FE7A2A8A93003BD3F@NTXBOIMBX02.micron.com>

On 2012-12-21 22:28, Sam Bradshaw (sbradshaw) wrote:
> 
>> -----Original Message-----
>> From: Jens Axboe [mailto:axboe@kernel.dk]
>> Sent: Friday, December 21, 2012 7:33 AM
>> To: Sam Bradshaw (sbradshaw)
>> Cc: fio@vger.kernel.org
>> Subject: Re: [PATCH] gettime: minimize integer division
>>
>> On 2012-12-20 20:23, Sam Bradshaw wrote:
>>>
>>>
>>> Something like this might work, though that amount of logic may
>>> be equivalent in terms of cycles to the divide.
>>
>> So I took a look at it. The costly bit is the division by
>> cycles_per_usec, which the compiler has no other option than turn into a
>> divq. The modulo and divide by 1M can be turned into something more
>> clever, basically shifts and imull.
>>
>> So how about the below? It turns the divq into multiplication and
>> division by 10M, which should be considerably less expensive. Can you
>> test and see how that works for you?
> 
> That works much better.  Several % lower execution time in fio_gettime().

Goodie

> IOPs look the same in my synthetic test but I'm not sure that's relevant;
> (it probably just needs some more tweaking).

It'd probably need 3-4M IOPS from a single thread to have a big impact.
But reduced CPU is leftover CPU for doing actual IO, so always a good
thing.

And just as important, did the timing look correct?

> I'll keep hunting for other hot spots.

Thanks!

-- 
Jens Axboe


  reply	other threads:[~2012-12-21 21:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-20  0:52 [PATCH] gettime: minimize integer division Sam Bradshaw
2012-12-20  8:14 ` Jens Axboe
2012-12-20 17:18   ` Sam Bradshaw
2012-12-20 18:03     ` Jens Axboe
2012-12-20 18:58       ` Sam Bradshaw (sbradshaw)
2012-12-20 19:23       ` Sam Bradshaw
2012-12-21 15:33         ` Jens Axboe
2012-12-21 15:45           ` Jens Axboe
2012-12-21 21:28           ` Sam Bradshaw (sbradshaw)
2012-12-21 21:30             ` Jens Axboe [this message]
2012-12-21 21:53               ` Sam Bradshaw (sbradshaw)
2012-12-23 20:49                 ` Jens Axboe

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=50D4D4F9.5070606@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=fio@vger.kernel.org \
    --cc=sbradshaw@micron.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