From: Jens Axboe <axboe@kernel.dk>
To: Arnd Bergmann <arnd@arndb.de>, "Ed L. Cashin" <ed.cashin@acm.org>
Cc: Tina Ruchandani <ruchandani.tina@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] aoe: use ktime_t instead of timeval
Date: Wed, 17 Jan 2018 08:41:42 -0700 [thread overview]
Message-ID: <7b4d1840-103f-dfb8-3918-678fdc93d816@kernel.dk> (raw)
In-Reply-To: <20180117153052.3831762-1-arnd@arndb.de>
On 1/17/18 8:30 AM, Arnd Bergmann wrote:
> From: Tina Ruchandani <ruchandani.tina@gmail.com>
>
> 'struct frame' uses two variables to store the sent timestamp - 'struct
> timeval' and jiffies. jiffies is used to avoid discrepancies caused by
> updates to system time. 'struct timeval' is deprecated because it uses
> 32-bit representation for seconds which will overflow in year 2038.
>
> This patch does the following:
> - Replace the use of 'struct timeval' and jiffies with ktime_t, which
> is the recommended type for timestamping
> - ktime_t provides both long range (like jiffies) and high resolution
> (like timeval). Using ktime_get (monotonic time) instead of wall-clock
> time prevents any discprepancies caused by updates to system time.
>
> [updates by Arnd below]
> The original patch from Tina never went anywhere as we discussed how
> to keep the impact on performance minimal. I've started over now but
> arrived at basically the same patch that she had originally, except for
> an slightly improved tsince_hr() function. I'm making it more robust
> against overflows, and also optimize explicitly for the common case
> in which a frame is less than 4.2 seconds old, using only a 32-bit
> division in that case.
>
> This should make the new version more efficient than the old code,
> since we replace the existing two 32-bit division in do_gettimeofday()
> plus one multiplication with a single single 32-bit division in
> tsince_hr() and drop the double bookkeeping. It's also more efficient
> than the ktime_get_us() API we discussed before, since that would
> also rely on multiple divisions.
Applied, thanks Arnd/Tina.
--
Jens Axboe
next prev parent reply other threads:[~2018-01-17 15:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-17 15:30 Arnd Bergmann
2018-01-17 15:41 ` Jens Axboe [this message]
2018-01-17 22:26 ` Ed Cashin
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=7b4d1840-103f-dfb8-3918-678fdc93d816@kernel.dk \
--to=axboe@kernel.dk \
--cc=arnd@arndb.de \
--cc=ed.cashin@acm.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ruchandani.tina@gmail.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®