lkml.org 
[lkml]   [2018]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Accuracy bounds of ktime_get_boot_fast_ns
On Sat, 23 Jun 2018, Jason A. Donenfeld wrote:
> void foobar_create(struct foobar *f)
> {
> f->birthdate = ktime_get_boot_fast_ns();
> }
> bool foobar_has_expired(struct foobar *f)
> {
> return f->birthdate + DEATH_AGE_SEC * NSEC_PER_SEC <=
> ktime_get_boot_fast_ns();
> }
>
> I'm wondering if I can actually get away with this last iteration.
> I've read the comments around the various _fast_ns functions, and they
> all indicate that it might not be totally monotonic with respect to
> all cpus. But I wonder if that actually matters for my use case. For
> example, is it still correct within a 10th or so of a second? Or will
> it occasionally be wrong by massive multi-second leaps, which would
> make it unsuitable for my usage? In other words, I'm wondering if
> there's still a level of accuracy for a certain low degree of
> precision?

The step backwards would be in the low nanoseconds range, so nothing to
worry about. The slope is not adjusted by large jumps, it's a very smooth
adoption through NTP/PTP.

Thanks,

tglx

\
 
 \ /
  Last update: 2018-06-23 22:16    [W:0.027 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site